4 ms·
Indeed, some things can't be done unless you use eval; but some of those things just need something much less than eval added to the language and then they can
by kazinator 12y ago
Indeed, some things can't be done unless you use eval; but some of those things just need something much less than eval added to the language and then they can be done.
Case in point: if you don't have apply in Lisp, how do you take a list, and turn it into the arguments of a function call?
The ability to do this is actually represents a modicum of introspection, but far short of a full blown eval.
- deleted 12y ago[deleted]
- GregBuchholz 12y ago;;; The Daily WTF to the rescue, no eval or introspection needed (defun my-apply (f lst) (case (length lst) (0 (funcall f)) (1 (funcall f (nth 0 lst))) (2 (funcall f (nth 0 lst) (nth 1 lst))) (3 (funcall f (nth 0 lst) (nth 1 lst) (nth 2 lst))) (t 'YouNeedToExtendThisInTheObviousWay))) ...IIRC Common Lisp allows your implementation to limit the number of arguments a function can take. http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/convar_call-a_uments-limit.html http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec...