Learning Haskell some time ago, I felt in love with pointfree notation and especially convenient partial function application - just supply args you know. In Clojure, I have partial
all the time. I think having a special syntax for partial in reader will be nice to have.
Look at the sample code:
; Notation with points:
(map (+ 10 (* % 2)) [1 2 3])
; With partial:
(map (comp (partial + 10) (partial * 2)) [1 2 3])
; Let #[] syntax means partial application in reader:
(map (comp #[+ 10] #[* 2]) [1 2 3])
This is so nice! Is there something like this? Is there possibility to define custom reader macro?
An anonymous function syntax #(...) can be used similarly to what you are trying to do:
is equivalent to:
A tiny little difference is
%
which just means a function argument, in this case the first and only.