Skip to content

Latest commit

 

History

History
19 lines (17 loc) · 561 Bytes

README.md

File metadata and controls

19 lines (17 loc) · 561 Bytes

dj.treefn

A more composable version of "let"

basic example

(require '[dj.dispatch.treefn :as tf])
(let [args {:name "bob"
            :born-year 2001
            :current-year 2020}
      fms {:age (tf/fm [:born-year :current-year]
                       (- current-year born-year))
           :message (tf/fm [:name :age]
                           (str "bob is " age " years old"))}
      the-tf (tf/treefm fms :message)]
  (the-tf args))
;; =>
{:name "bob", :born-year 2001, :current-year 2020, :age 19, :message "bob is 19 years old"}