nest and comments

This commit is contained in:
Jay McCarthy 2015-11-23 17:24:57 -05:00
parent 4b0a38e588
commit 04514bc6e7
3 changed files with 12 additions and 6 deletions

View File

@ -202,5 +202,5 @@ TODO greg's defs
https://github.com/greghendershott/defn
https://github.com/greghendershott/def-jambda
TODO nest form like def* for things like parameterize that would look
DONE nest form like def* for things like parameterize that would look
weird as def* transformers

View File

@ -237,7 +237,8 @@
(provide def def*
(rename-out [def ]
[def* ≙*])
[def* ≙*]
[def* nest])
(rename-out [remix-λ λ]
[remix-cond cond]
[remix-cut-$ $])

View File

@ -148,20 +148,24 @@
(module+ test
{v28 28})
;; def* allows nested binding inside blocks
;; def* allows nested binding inside blocks. This is aliased to nest
;; for def* transformers like parameterize that would look strange
;; otherwise.
(def v64
(def* x 2)
(def* x {x + x})
(def* x {x + x})
(def* x {x + x})
(nest x {x + x})
(def* x {x + x})
(def* x {x + x})
x)
(module+ test
{v64 64})
;; (def [stx #%posn] (layout x y))
;; The lambda and def syntax allow all the normal forms of Racket
;; function arguments. The main exception being rest arguments are
;; specified differently because the . would be parsed incorrectly
;; otherwise.
(def (f-no-args) 42)
(def (f-one-arg x) x)
(def (f-kw-arg #:x x) x)
@ -181,3 +185,4 @@
{(f-rest-args) 42}
{(f-rest-args 1) 42}
{(f-rest-args 1 2 3) 42})