3 ms·
Nested DEFUNs? Not in Lisp. In Common Lisp use LABELS for recursive local functions. I'd avoid recursive code like that as much as possible. I'd write: (
by lispm 11y ago
Nested DEFUNs? Not in Lisp. In Common Lisp use LABELS for recursive local functions.
I'd avoid recursive code like that as much as possible.
I'd write:
(defun ab (l)
(loop while l collect (pop l) into a
while l collect (pop l) into b
finally (return (list a b))))
- agumonkey 11y agoOops, I forgot defun affected the global namespace. Your last example is nice. I had to read the CLHS loop to have a clue about linearity of multiple termination clauses though :) ps: funny, while googling I even found some lisp checker with a rule about nested defuns (## define-lisp-pattern nested-defuns) http://www.cs.northwestern.edu/academics/courses/325/programs/cs325/lisp-rules.lisp http://www.cs.northwestern.edu/academics/courses/325/program...