/kw-make-struct

like make from unstable/struct except allowing keywords, and it can also be a match pattern

Primary LanguageRacket

kw-make-struct

Build Status

documentation: http://pkg-build.racket-lang.org/doc/kw-make-struct/index.html

like make from unstable/struct except allowing keywords

make/kw is also defined as a match-expander.

Examples:

> (struct foo (a b c) #:transparent)
> (make/kw foo 'a 'b 'c)
(foo 'a 'b 'c)
> (make/kw foo #:a 'a #:b 'b #:c 'c)
(foo 'a 'b 'c)
> (make/kw foo #:a 'a 'b 'c)
(foo 'a 'b 'c)
> (make/kw foo #:c 'c 'a #:b 'b)
(foo 'a 'b 'c)
> (match (foo 'a 'b 'c)
    [(make/kw foo #:a a #:b b #:c c)
     (list a b c)])
'(a b c)