Skip to content

Instantly share code, notes, and snippets.

@xhh
Last active March 1, 2020 13:07

Revisions

  1. xhh revised this gist Mar 1, 2020. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion clojure_misc.clj
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,8 @@
    (defmacro comp* [& fns]
    (defmacro comp*
    "The left-to-right version of comp.
    Takes a set of functions and returns a fn that is the composition
    of those fns. The returned fn takes a variable number of args,
    applies the leftmost of fns to the args, the next
    fn (left-to-right) to the result, etc."
    [& fns]
    `(comp ~@(reverse fns)))
  2. xhh created this gist Mar 1, 2020.
    2 changes: 2 additions & 0 deletions clojure_misc.clj
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    (defmacro comp* [& fns]
    `(comp ~@(reverse fns)))