Trick
vlad-km opened this issue · comments
vlad commented
Welcome to JSCL (version 0.8.2 built on 10 September 2022)
JSCL is a Common Lisp implementation on Javascript.
For more information, visit the project page at [GitHub](https://github.com/jscl-project/jscl).
CL-USER> (defun nil nil t)
NIL
CL-USER> (defun t nil nil)
T
CL-USER> (cond ((t) :one) ((nil) :two))
:TWO
CL-USER>
have fun
vlad commented
CL-USER> (defun example (y l)
... (flet ((attach (x)
... (setq l (append l (list x)))))
... (declare (inline attach))
... (dolist (x y)
... (unless (null (cdr x))
... (attach x)))
... l))
...
EXAMPLE
CL-USER> (example '((a apple apricot) (b banana) (c cherry) (d) (e))
... '((1) (2) (3) (4 2) (5) (6 3 2)))
ERROR: Variable ATTACH is unbound.
CL-USER> (defun example (y l)
... (flet ((attach (x)
... (setq l (append l (list x)))))
... ;(declare (inline attach))
... (dolist (x y)
... (unless (null (cdr x))
... (attach x)))
... l))
...
EXAMPLE
CL-USER> (example '((a apple apricot) (b banana) (c cherry) (d) (e))
... '((1) (2) (3) (4 2) (5) (6 3 2)))
((1) (2) (3) (4 2) (5) (6 3 2) (A APPLE APRICOT) (B BANANA) (C CHERRY))
CL-USER>