Functional programming -- 2008-2009 -- info.uvt.ro/Laboratory 8
From Wikiversity
[edit] Macros
[edit] References
- previous year laboratory:
- the Common Lisp Hyperspec reference:
- or:
[edit] Examples
- the examples were provided:
- Dan Claudiu Codrean;
> (defmacro my-or (e1 e2) (let ((v (gensym))) `(let ((,v ,e1)) (if ,v ,v ,e2)))) MY-OR
> (defmacro my-dolist (i lst r &rest b) (let ((lst* (gensym)) (l* (gensym))) `(let ((,lst* ,lst)) (if (null ,lst* ,r) (do* ( (,l* ,lst* (rest ,l*)) (,i (first ,l*) (first ,l*))) ( (null ,l*) ,r) ,@b))))) MY-DOLIST