I wish apply a sequence of functions to a data, like pipe: http://ramdajs.com/0.14/docs/#pipe
I know it has ->>
and ->
, also I have difficulty in defining the internal functions
(defn create
([code error] {:statusCode code :error error})
([code error & [message data]]
(create code error) - I want pipe it result
to a function that check if
message if defined then merge with
{:message message}, then
apply to a function that checks if data
is defined an merge with it
))
You could use
cond->
threading macro to merge only defined variables:or you could define small
assoc-if-defined
helper and use ordinary->
threading macro: