freenode/#lisp - IRC Chatlog
Search
17:06:20
Josh_2
What would be the lispy way to solve this problem, print out numbers 1 - 10 in a random order
17:06:38
Josh_2
I have a solution but I don't think It's very good. I am just curious this is not for anything serious
17:09:16
aeth
What I would do not knowing the correct algorithm for shuffling or anything like that would be to make an adjustable vector with the contents #(0 1 2 3 4 5 6 7 8 9 10) and swap the number I'm removing with the last item and then vector-pop
17:11:21
minion
The URL https://gitlab.common-lisp.net/users/sign_in?secret=0b13392c will be valid until 17:15 UTC.
17:15:49
aeth
dlowe: Yeah, but you can just use the vector length as what you call random with so it's not a complete waste to do it as actually adjustable
18:08:50
dlowe
I mention that because I didn't actually know it wasn't a good shuffle for a long time
18:11:07
pjb
White_Flame: sort doesn't guarantee much on the order of elements if you don't give it an order function. You will have "elements [will be] scrambled in some unpredictable way". Which doesn't mean it will be a random shuffle.
18:11:45
White_Flame
pjb: while it may just look like a spurious trailing comment, I did put a smiley at the end for a reason
18:17:07
ck_
also, Fisher-Yates is the same thing as the Knuth shuffle, right? I wonder how many months between the implementations
18:22:56
aeth
Here's "my" algorithm with the efficiency adjustment dlowe (Knuth?) gave of not even having to pop an adjustable, and just working on the index directly
18:24:01
aeth
I think that's correct... technically 16-bit Lisps might not like me using fixnum instead of alexandria:array-index, but you probably won't notice this on a modern 64-bit Lisp, and either way, you'd just get an out of bounds error if I'm wrong.
18:25:39
aeth
dlowe: This is specifically for integers starting with 1, and it will have to be a fixnum because it will also have to double as an array index
18:30:04
aeth
Bike: it's shuffling the numbers 1 to 10 (or 1 to n in my generalization) so it's a more specific problem. In this case, the elements can't be any larger than array-dimension-limit which must be a positive fixnum or the algorithm won't work
18:33:13
aeth
Bike: since the problem was specifically for numbers from 1 to n, the elements are necessarily of the type `(integer 1 ,array-dimension-limit) which is necessarily a subset of fixnum. I should probably check-type for the more specific type, though
18:34:28
aeth
Bike: I meant to say that the type doubles as an array index, but that's not true, either, since it's actually shifted up by 1
20:14:31
iarebatm`
How would you guys go about implementing a 'throttle'? ex, I want to use dexador to issue http requests against a web service, but that service has a maximum requests/per-second that I'm allowed to use.
20:17:40
dlowe
You might consider something more sophisticated, like retrying with exponential backoff
20:57:32
minion
The URL https://gitlab.common-lisp.net/users/sign_in?secret=71ee1b95 will be valid until 21:00 UTC.
23:02:27
aeth
I think I'm going to do a CommonMark implementation to generate static sites for Github/Gitlab pages. There are two markdown implementations in Quicklisp, but neither give any indication that they implement the CommonMark spec, i.e. https://spec.commonmark.org/
23:03:57
aeth
I also see no CL implementation here, although there is an elisp one. https://github.com/commonmark/commonmark-spec/wiki/List-of-CommonMark-Implementations
0:01:11
aeth
pjb: I use org-mode near-daily and it's good for what it is... notes, todo lists, a miniature spreadsheet, etc.
0:02:19
aeth
pjb: Markdown is better for generating lightly-formatted HTML, though, imo. In part because it's standardized, unlike org-mode, which has a ton of stuff that's heavily dependent on Emacs (like the spreadsheet functionality that's literally built into its tables)
0:04:58
aeth
I wouldn't choose org-mode over Markdown for HTML generation, just like I wouldn't choose org-mode over LaTeX for PDFs/books.
1:00:56
alexanderbarbosa
anyone knows how to clean previous sbcl custom prefixed instalations files? clean and dist-clean aint that
1:59:18
mrcode_
does anyone know how to solve a 'warning unused variable autotype_tmp' error from cffi groveller ? seems to prevent loading of a package
2:08:33
iarebatm`
Can anyone recommend a library for parsing arbitrary date/time strings into some sort of standard datetime representation?
2:09:48
iarebatm`
simple-date-time seems to recommend local-time, but local-time doesn't parse formats such as "01/01/2019". net-telent-date is marked as deprecated...
2:10:22
iarebatm`
what's the right thing to do in this case, parse out the date parts and construct my own local-time manually?
2:12:15
pjb
(encode-universal-time (parse-integer string :start 6) (parse-integer string :start 3 :junk-allowed) (parse-integer string :start 0 :junk-allowed))
2:12:41
pjb
(encode-universal-time 0 0 0 (parse-integer string :start 0 :junk-allowed) (parse-integer string :start 3 :junk-allowed) (parse-integer string :start 6))
2:13:50
pjb
or: (apply (function encode-universal-time) 0 0 0 (mapcar (function parse-integer) (split-sequence #\/ string)))
3:52:38
no-defun-allowed
beach: I should thank you for bringing up the mode though, now I can write `((lambda (x) x) 2) evto 2` and feel slightly less icky by using Unicode arrows.
3:54:24
no-defun-allowed
`((lambda (x) x) 2) ↦ 2` Emacs has a weird pause when I load any unicode characters though, possibly because it has to load a fallback font since CMU Typewriter Text doesn't have that character.
3:55:13
beach
I can't imagine having to type things like "first-class global environments", "Common Lisp HyperSpec", "(admittedly small) family", etc. whenever I want to mention those concepts. :)
3:58:19
beach
... and since I am apparently turning dyslexic, I would make typos trying to type those phrases each time, thereby slowing me down even more.
3:59:08
no-defun-allowed
Hm, macOS has an abbrev expander but I always thought it was annoying (since it is bound to autocorrection), which would be handy since Emacs isn't my matrix client.
4:00:44
beach
Now, what I would really like is to be able to use the same abbrev expander everywhere, in the editor, on the command line, etc.
4:01:10
no-defun-allowed
Excellent! The already half-broken input box on riot.im also breaks macOS's autocorrect too.
4:02:40
no-defun-allowed
Maybe matrix-client.el is calling again. Anyways, abbrev is very neat, thanks for mentioning it, beach.