Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



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...).


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.


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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: