Implement a `while' macro.
This commit is contained in:
@@ -61,3 +61,8 @@ Like the `|>' operator in Ocaml."
|
|||||||
:for canon-func = (if (symbolp func) (list func) func)
|
:for canon-func = (if (symbolp func) (list func) func)
|
||||||
:do (setq acc (append canon-func (list acc)))
|
:do (setq acc (append canon-func (list acc)))
|
||||||
:finally (return acc))))
|
:finally (return acc))))
|
||||||
|
|
||||||
|
(defmacro while (condition &body body)
|
||||||
|
`(loop :while ,condition
|
||||||
|
:do
|
||||||
|
(progn ,@body)))
|
||||||
|
|||||||
@@ -20,7 +20,8 @@
|
|||||||
(defpackage lib.macros
|
(defpackage lib.macros
|
||||||
(:use :cl)
|
(:use :cl)
|
||||||
(:export
|
(:export
|
||||||
:_ :--> :->>))
|
:_ :--> :->>
|
||||||
|
:while))
|
||||||
|
|
||||||
(defpackage main
|
(defpackage main
|
||||||
(:use :cl :lib.macros)
|
(:use :cl :lib.macros)
|
||||||
|
|||||||
Reference in New Issue
Block a user