Skip to content

anler/implicits

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

implicits

This is highly experimental and in a big WIP state.

A Clojure library for defining functions with implicit parameters.

Usage

(require '[implicits.core :as i])


(i/defimplicit subject "My implicit value" "World")

(clojure.repl/doc subject)
;; -------------------------
;; implicits.core/subject
;;   My implicit value
;; => nil

(i/defn say-hello
  [subject]
  [& [message]]
  (format (or message "Hello, %s!") subject))

(say-hello)
;; => "Hello, World!"

(say-hello (i/implicitly subject "Planet"))
;; => "Hello, Planet!"

(say-hello "Hi, %s!")
;; => "Hi, World!"

(say-hello (i/implicitly subject "Planet") "Hi, %s!")
;; => "Hi, Planet!"

License

Copyright © 2018 Anler Hernández Peral

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

About

Implicit function parameters in Clojure

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published