Skip to content

Commit

Permalink
'and' macro example
Browse files Browse the repository at this point in the history
  • Loading branch information
pwmarcz authored and nishio committed Jun 17, 2012
1 parent 7c5e9bf commit e57593b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@
(cons (func (car list))
(map func (cdr list)))))
(map (lambda (x) (+ x 1)) '(1 2 3))

; And macro example
(defmacro (and x . xs)
(if (empty? xs)
x
`(when ,x (and . ,xs))))
(expand-code '(and a b c d))
; and to demonstrate the short-circuit mechanism:
; ((unknown) should crash when run)
(and (= 2 2) (= 2 3) (unknown))
</textarea>
<input type="button" id="clear" value="Clear terminal" />
<input type="button" id="load" value="Load source" />
Expand Down

0 comments on commit e57593b

Please sign in to comment.