Commits

Jan Herich  committed bb1746a

Fix behavior of the as-> macro

  • Participants
  • Parent commits b529570

Comments (0)

Files changed (2)

File clojurian-syntax.scm

 
 (define-syntax as->
   (syntax-rules ()
-    ((_ state name rest ...)
+    ((_ state name) state)
+    ((_ state name expr)
      (let ((name state))
-       rest ...))))
+       expr))
+    ((_ state name expr rest ...)
+     (as-> (let ((name state))
+             expr) name rest ...))))
 
 (define-syntax ->
   (syntax-rules ()

File tests/syntax.scm

              (list 3)
              (append '(4))))
 
+  (test 2 (as-> 1 x (+ x 3) (/ x 2)))
   (test 5 (-> 10 (* 2) (as-> state (/ state 4))))
 
   (test 7 (-> 10 (- 3)))