I'd like to find out what is the commonly accepted way to create a sorted list of random numbers in Common Lisp. In Clojure it is quite straightforward:
(sort (take 10 (repeatedly #(rand 10))))
I've found that in CL the following works:
(sort (loop for n below 10 collect (random 10)) #'<)
but does not read as well. Is there a cleaner way to express the same thing?
Almost:
(sort (loop repeat 10 collect (random 10)) #'<)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With