libera/#commonlisp - IRC Chatlog
Search
22:02:06
Josh_2
Normally I would write (restart-case ..) but I want restarts based on the classes of the arguments provided :think:
22:03:29
Bike
Josh_2: you can control the restarts more precisely with restart-bind. i am not sure if that's what you mean though.
23:15:45
nij-
(sort '(1 2) #'>) is undefined because #'sort is destructive according to CLHS. Would (sort (copy-list '(1 2) #'>)) makes the situation better? If not, what should I do?
23:35:23
pjb
nij-: it's not necessarily true, but I believe that sorting vectors should be faster than sorting lists. So I'd expect (sort (make-array 2 :initial-contents '(1 20)) #'>) #| --> #(20 1) |# to be faster.
1:18:36
verisimilitude
It's nothing array displacement can't solve, but it's so odd how SORT doesn't accept :START and :END.
1:31:51
aeth
yes, it's definitely out of place, given how almost every good sequence function (in the standard or not) does
1:32:28
aeth
you can also sort indices, though, e.g. (let ((a (vector 9 4 3 7 1))) (sort (vector 0 1 2 3 4) #'< :key (lambda (x) (aref a x))))
1:34:22
aeth
e.g. (let ((a (vector 9 4 3 7 1))) (sort (vector 2 3 4) #'< :key (lambda (x) (aref a x))))
3:11:37
dre
and someone asked me about it and I said "the function is basically a documenting label to the set comprehension"
3:11:47
jcowan
I think that requiring SORT to support both lists and :start :end would be obnoxious.
3:12:26
dre
is that why CL uses `labels` as defining functions? you're literally labelling some lisp forms as their own little name thing
3:13:11
hayley
I recall gilberth mentioned it was a reference to "labels" in assembly, especially when you consider tail-calling to be jumping.
3:32:29
dre
I sometimes find the CL naming to be a little bit difficult but that's just my newbiness
3:59:53
aeth
When CL has better names than Scheme, it's accidental. e.g. CL:MAP is better because the generic name was available, but Scheme already renamed MAPCAR to MAP.