Next: , Previous: SRFI-19, Up: SRFI Support


39.16 SRFI-26 - Notation for specializing parameters

This is an implementation of SRFI-26: Notation for specializing parameters without Currying (also known as “curry-which-is-not-curry”).

— Scheme Macro: cut slot [slots...]

Expand to a procedure that specializes slot and slots, if they are the special symbol <> or <...>. The latter can only appear as the last element of slots. Elements that are neither of these special symbols are evaluated at run-time in their respective positions.

— Scheme Macro: cute [slots...]

Expand to a procedure that specializes slots, if they are the special symbol <> or <...>. The latter can only appear as the last element of slots. Elements that are neither of these special symbols are evaluated at expansion-time in their respective positions.

Here are the examples given in the SRFI 26 specification:

     (cut cons (+ a 1) <>)    ===  (lambda (x2) (cons (+ a 1) x2))
     (cut list 1 <> 3 <> 5)   ===  (lambda (x2 x4) (list 1 x2 3 x4 5))
     (cut list)               ===  (lambda () (list))
     (cut list 1 <> 3 <...>)  ===  (lambda (x2 . xs) (apply list 1 x2 3 xs))
     (cut <> a b)             ===  (lambda (f) (f a b))
     
     (cute cons (+ a 1) <>)   ===  (let ((a1 (+ a 1)))
                                      (lambda (x2) (cons a1 x2)))