misc def stuff
This commit is contained in:
parent
8d43fc9770
commit
27f471e04e
|
@ -210,7 +210,6 @@
|
||||||
(pattern x:id
|
(pattern x:id
|
||||||
#:attr λ-arg (syntax x)
|
#:attr λ-arg (syntax x)
|
||||||
#:attr λ-bind '())
|
#:attr λ-bind '())
|
||||||
;; xxx write a test for this
|
|
||||||
(pattern (~and def-lhs:expr (#%brackets dt . _))
|
(pattern (~and def-lhs:expr (#%brackets dt . _))
|
||||||
#:declare dt (static def-transformer? "def transformer")
|
#:declare dt (static def-transformer? "def transformer")
|
||||||
#:with x (generate-temporary #'def-lhs)
|
#:with x (generate-temporary #'def-lhs)
|
||||||
|
@ -269,7 +268,6 @@
|
||||||
[(_#%dot _λ body:expr)
|
[(_#%dot _λ body:expr)
|
||||||
(syntax/loc stx
|
(syntax/loc stx
|
||||||
(remix-cut body))]
|
(remix-cut body))]
|
||||||
;; xxx test this
|
|
||||||
[(_#%dot _λ bodies:expr ...)
|
[(_#%dot _λ bodies:expr ...)
|
||||||
(syntax/loc stx
|
(syntax/loc stx
|
||||||
(remix-cut (#%dot bodies ...)))]))])
|
(remix-cut (#%dot bodies ...)))]))])
|
||||||
|
|
|
@ -251,4 +251,13 @@
|
||||||
(def [example^ ee] 1)
|
(def [example^ ee] 1)
|
||||||
(module+ test
|
(module+ test
|
||||||
{(ee.f 2) ≡ 1}
|
{(ee.f 2) ≡ 1}
|
||||||
{(ee.g 2) ≡ 2})
|
{(ee.g 2) ≡ 2}
|
||||||
|
;; Notice that cut works with nested dots
|
||||||
|
{(λ.example2^.h 'ignored) ≡ 19})
|
||||||
|
|
||||||
|
;; This is especially useful inside of functions
|
||||||
|
(def (f-using-example [example^ ee])
|
||||||
|
(ee.f 2))
|
||||||
|
(module+ test
|
||||||
|
{(f-using-example 1) ≡ 1})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user