This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use lodash/underscore, this could probably actually be a mixin for those | |
compose = (fns) -> | |
_.reduceRight fns, (composed, currentFn) -> | |
_.compose (valueOrPromise) -> | |
vop = valueOrPromise | |
if Boolean vop and vop.then | |
vop.then (value) -> | |
currentFn value | |
else | |
currentFn vop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Clojure actually has a queue type, but it's not easily accesible. Here's a function to help with that | |
(defn queue | |
([] clojure.lang.PersistentQueue/EMPTY) | |
([& elements] | |
(into (queue) elements))) |
NewerOlder