Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alexknauth/kw-make-struct
Naming struct fields with keywords for constructing and matching
https://github.com/alexknauth/kw-make-struct
Last synced: about 1 month ago
JSON representation
Naming struct fields with keywords for constructing and matching
- Host: GitHub
- URL: https://github.com/alexknauth/kw-make-struct
- Owner: AlexKnauth
- License: mit
- Created: 2014-07-25T18:52:50.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-01-07T14:37:54.000Z (almost 3 years ago)
- Last Synced: 2024-10-16T02:55:02.602Z (3 months ago)
- Language: Racket
- Homepage:
- Size: 27.3 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
kw-make-struct [![Build Status](https://travis-ci.org/AlexKnauth/kw-make-struct.png?branch=master)](https://travis-ci.org/AlexKnauth/kw-make-struct)
===documentation: http://pkg-build.racket-lang.org/doc/kw-make-struct/index.html
like [make](http://docs.racket-lang.org/unstable/struct.html#%28form._%28%28lib._unstable%2Fstruct..rkt%29._make%29%29) from unstable/struct except allowing keywords
`make/kw` is also defined as a match-expander.
Examples:
```racket
> (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)
```