Clojure macros for function definitions
Clojure
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/main/clojure/com/github/sebhoss
.gitignore
.travis.yml
CONTRIBUTING.textile
README.textile
pom.xml

README.textile

def-clj

Clojure helper functions for function definitions.

Usage

The namespace com.github.sebhoss.def offers the following functions:

  • (defnk name decls) Defines a keyword-based function
  • (defn* name decls) Defines both Clojure and Java functions (using the standard prefix -). Usefull for Java interoperability.

Example

defnk

(require '[com.github.sebhoss.def :refer :all])

(defnk my-func [:key1 :key2 :key3] ...)
; expandes to: (defn my-func [& {:keys [key1 key2 key3]}] ...)

defn*

(require '[com.github.sebhoss.def :refer :all])

(defn* my-func [params] ...)
; expandes to (defn my-func [params] ...) and (defn -myFunc [params] ...)

Integration

Maven

<dependencies>
  <dependency>
    <groupId>com.github.sebhoss</groupId>
    <artifactId>def-clj</artifactId>
    <version>[1.0.0,2.0.0)</version>
  </dependency>
</dependencies>

Leiningen

[com.github.sebhoss/def-clj "[1.0.0,2.0.0)"]

License

This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.