I really like your idea for a partial function notation using the #[ ] literal.
Unfortunately, Clojure does not let us enhance the #() notation directly, but we can define ourselves a macro like #p
for a partial application.
Given you have a function
(defn partial-wrap
[args]
(concat '(partial) args))
defined in myapp.core
.
You can add the following entry into the data_readers.clj
at the top of your classpath:
{p myapp.core/partial-wrap}
(usually one should use a namespace qualified symbol here like a/p
, since unqualified symbols are reserved for Clojure. Nevertheless unqualified symbols do work, you need to rely on Clojure not overwriting them in a future version).
This finally allows to do almost what you asked for:
(map (comp #p[+ 10] #p[* 2]) [1 2 3])
=> (12 14 16)