
Lisp Idioms - fogus
http://cybertiggyr.com/gene/lid/
======
zachbeane
Gene Michael Stover wrote about Common Lisp as someone who hardly ever looked
at anyone else's idiomatic use of the language. I was pretty bummed that he
got published in Dr. Dobbs with some pretty awful CL code.

------
technomancy
Might be useful to mention that these are mostly specific to CL.

------
araxima
If you happen to know the sequence is a list then might as well (apply #'min
'(1 2 3 4 5)) instead of (reduce #'min '(1 2 3 4 5)).

I'm sure the author is aware of that, but a reader might get the impression
that #'min can only take two arguments.

~~~
sedachv
Apply has the problem in that Common Lisp allows compilers to restrict the
number of arguments passed to a function to a small value (specified by call-
arguments-limit:
[http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec...](http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_call-
a_uments-limit.html)).

~~~
jpr
I'm not well versed in CLHS legalese, but don't &rest arguments count as one
argument? One would suspect so since &rest is allowed to be not copied.

~~~
gchpaco
Even if it is you still have to cons up all those arguments whereas reduce
doesn't.

------
aidenn0
His first accumulate misses what is to me the most obvious way:

(defun accumulate-f (n) (let* ((end (list (next))) (n (1- n)) (start end))
(dotimes (_ n start) (rplacd end (cons (next) nil)) (setq end (cdr end)))))

