nest and comments
This commit is contained in:
parent
4b0a38e588
commit
04514bc6e7
|
@ -202,5 +202,5 @@ TODO greg's defs
|
||||||
https://github.com/greghendershott/defn
|
https://github.com/greghendershott/defn
|
||||||
https://github.com/greghendershott/def-jambda
|
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
|
weird as def* transformers
|
||||||
|
|
|
@ -237,7 +237,8 @@
|
||||||
|
|
||||||
(provide def def*
|
(provide def def*
|
||||||
(rename-out [def ≙]
|
(rename-out [def ≙]
|
||||||
[def* ≙*])
|
[def* ≙*]
|
||||||
|
[def* nest])
|
||||||
(rename-out [remix-λ λ]
|
(rename-out [remix-λ λ]
|
||||||
[remix-cond cond]
|
[remix-cond cond]
|
||||||
[remix-cut-$ $])
|
[remix-cut-$ $])
|
||||||
|
|
|
@ -148,20 +148,24 @@
|
||||||
(module+ test
|
(module+ test
|
||||||
{v28 ≡ 28})
|
{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 v64
|
||||||
(def* x 2)
|
(def* x 2)
|
||||||
(def* x {x + x})
|
(def* x {x + x})
|
||||||
(def* x {x + x})
|
(def* x {x + x})
|
||||||
(def* x {x + x})
|
(nest x {x + x})
|
||||||
(def* x {x + x})
|
(def* x {x + x})
|
||||||
(def* x {x + x})
|
(def* x {x + x})
|
||||||
x)
|
x)
|
||||||
(module+ test
|
(module+ test
|
||||||
{v64 ≡ 64})
|
{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-no-args) 42)
|
||||||
(def (f-one-arg x) x)
|
(def (f-one-arg x) x)
|
||||||
(def (f-kw-arg #:x x) x)
|
(def (f-kw-arg #:x x) x)
|
||||||
|
@ -181,3 +185,4 @@
|
||||||
{(f-rest-args) ≡ 42}
|
{(f-rest-args) ≡ 42}
|
||||||
{(f-rest-args 1) ≡ 42}
|
{(f-rest-args 1) ≡ 42}
|
||||||
{(f-rest-args 1 2 3) ≡ 42})
|
{(f-rest-args 1 2 3) ≡ 42})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user