Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boxed/defk
Compact keyword arguments for clojure
https://github.com/boxed/defk
Last synced: about 1 month ago
JSON representation
Compact keyword arguments for clojure
- Host: GitHub
- URL: https://github.com/boxed/defk
- Owner: boxed
- License: epl-1.0
- Created: 2015-10-11T19:27:07.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-13T19:47:31.000Z (about 9 years ago)
- Last Synced: 2024-10-09T00:43:59.465Z (3 months ago)
- Language: Clojure
- Size: 129 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/boxed/defk.svg)](https://travis-ci.org/boxed/defk)
# defk
A Clojure library designed to make keyword arguments not just easier but so much easier in fact that you
might just never use anything else again.## Usage
Instead of using `defn` to define your function, use `defk`. Now anyone who calls your function gets keyword
argument semantics automatically. An example is easier:```clojure
(defk foo [a b]
(- a b))(let [a 1, b 2]
(foo b a)) ; <- returns 1 - 2, NOT 2 - 1. How? Because the NAME a and
; b are used, not the positions of those variables at the call site
```You can of course also pass in the value of variables with other names or literals:
```clojure
(let [c 2]
(foo a=1 b=c))(foo a=(+ 1 2 3) b=2)
```The underlying function can be called directly like so:
```clojure
(foo-raw {:a 1, :b 2})
```## License
Copyright © 2015 Anders Hovmöller
Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.