clcut
Macros for partial application of expressions in the spirit of SRFI 26.
CLCUT
Utilities to partially apply functions or expressions in the spirit of `Scheme SRFI 26: Notation for Specializing Parameters without Currying' http://srfi.schemers.org/srfi26/srfi26.html

Macro
CUT
(slotorexpr &rest slotorexpr*)CUT partially applies its first argument, which can be a symbol (which is treated as a function) or an expression that evaluates to a function. Any argument of CUT that appears as a slot `<>' will be a positional argument of the resulting partially applied function, even for the first argument (the function position). A special slot `<...>' can be the last argument of CUT which is then treated as a REST argument for the partial application. Example expansions: (mapcar (cut member <> (list a b c) :test 'equal) thingstofind) => (MAPCAR (LAMBDA (#:SLOT1) (MEMBER #:SLOT1 (LIST A B C) :TEST 'EQUAL)) THINGSTOFIND) (cut + <> (+ x 1) <>) => (LAMBDA (#:SLOT1 #:SLOT2) (+ #:SLOT1 (+ X 1) #:SLOT2)) (cut <> 1 2 3 <>) => (LAMBDA (#:SLOT1 #:SLOT2) (FUNCALL #:SLOT1 1 2 3 #:SLOT2)) (cut + 1 x <...>) => (LAMBDA (&REST #:RESTSLOT1) (APPLY #'+ 1 X #:RESTSLOT1)) (cut <> 1 x <...>) => (LAMBDA (#:SLOT1 &REST #:RESTSLOT2) (APPLY #:SLOT1 1 X #:RESTSLOT2)) (cut (if (= 0 (random 10)) #'+ #') 10 <...>) => (LAMBDA (&REST #:RESTSLOT1) (APPLY (IF (= 0 (RANDOM 10)) #'+ #') 10 #:RESTSLOT1)) (cut (cut <> <>) <> <>) => (LAMBDA (#:SLOT1 #:SLOT2) (FUNCALL (LAMBDA (#:SLOT3 #:SLOT4) (FUNCALL #:SLOT3 #:SLOT4)) #:SLOT1 #:SLOT2)) 
Macro
CUT*
(slotorexpr &rest slotorexpr*)Like CUT, but treats a nonslot symbol in the first argument as a value instead of a function. Examples: (mapcar (cut* member <> (list a b c) :test 'equal) thingstofind) => (MAPCAR (LAMBDA (#:SLOT1195) (FUNCALL MEMBER #:SLOT1195 (LIST A B C) :TEST 'EQUAL)) THINGSTOFIND) (let ((somefunc (lambda (x y) ( x y)))) (cut* somefunc <> 1)) => (LET ((SOMEFUNC (LAMBDA (X Y) ( X Y)))) (LAMBDA (#:SLOT1) (FUNCALL SOMEFUNC #:SLOT1 1))) (cut* list 'a <...>) => ;; Notice LIST and not #'LIST, which may cause an error. (LAMBDA (&REST #:RESTSLOT1) (APPLY LIST 'A #:RESTSLOT1)) (cut* <> 'a 'b) => ;; Same as (cut <> 'a 'b). (LAMBDA (#:SLOT1) (FUNCALL #:SLOT1 'A 'B)) 
Macro
CUTE
(slotorexpr &rest slotorexpr*)Like CUT, but evaluates all arguments except the first. Examples: (mapcar (cute member <> (list a b c) :test 'equal) thingstofind) => (MAPCAR (LET ((#:LETBINDING1 (LIST A B C)) (#:LETBINDING2 :TEST) (#:LETBINDING3 'EQUAL)) (LAMBDA (#:SLOT4) (MEMBER #:SLOT1199 #:LETBINDING1196 #:LETBINDING1197 #:LETBINDING1198))) THINGSTOFIND) (cute list (if flag 'a 'b) <...>) => (LET ((#:LETBINDING1 (IF FLAG 'A 'B))) (LAMBDA (&REST #:RESTSLOT2) (APPLY #'LIST #:LETBINDING1 #:RESTSLOT2))) (cute <> 1 (complexcomputation)) => (LET ((#:LETBINDING1 1) (#:LETBINDING2 (COMPLEXCOMPUTATION))) (LAMBDA (#:SLOT3) (FUNCALL #:SLOT3 #:LETBINDING1 #:LETBINDING2))) 
Macro
CUTE*
(slotorexpr &rest slotorexpr*)Like CUTE, but evaluates all arguments as values, including the first argument. Examples: (mapcar (cute* member <> (list a b c) :test 'equal) thingstofind) => (MAPCAR (LET ((#:LETBINDING1 MEMBER) ;; Notice how MEMBER is bound here. (#:LETBINDING2 (LIST A B C)) (#:LETBINDING3 :TEST) (#:LETBINDING4 'EQUAL)) (LAMBDA (#:SLOT5) (FUNCALL #:LETBINDING1 #:SLOT5 #:LETBINDING2 #:LETBINDING3 #:LETBINDING4))) THINGSTOFIND) (cute* somevalue <> 10 <...>) => (LET ((#:LETBINDING1 SOMEVALUE) (#:LETBINDING2 10)) (LAMBDA (#:SLOT3 &REST #:RESTSLOT4) (APPLY #:LETBINDING1 #:SLOT3 #:LETBINDING2 #:RESTSLOT4))) (cute* <> 'foo <>) => (LET ((#:LETBINDING1 'FOO)) (LAMBDA (#:SLOT2 #:SLOT3) (FUNCALL #:SLOT2 #:LETBINDING1 #:SLOT3)))