A cuter SRFI-26: Numbered notation for specializing parameters without currying. Yuval Langer (04 Aug 2026 22:24 UTC)

A cuter SRFI-26: Numbered notation for specializing parameters without currying. Yuval Langer 04 Aug 2026 22:23 UTC

Hi,

for a while now I wanted to write two macros, `cuter` and `cutr`, that
would work similarily to `cute` and `cut`, but instead of using the
positional `<>` holes syntax, would use numbered holes in the form of
`<i>`, where `i` goes from `0` up to and including `n-1`.

Examples:

```scheme
(import (srfi srfi-26) (srfi srfi-27))

;; The `cute` equivalent would be called `cuter` and this invocation:

((cuter list (random-real) <1> <0> <1>)
 (random-integer 4)
 (random-integer 20))

;; would be the same as:

((let ((binding-0 list)
       (binding-1 (random-real)))
   (lambda (hole-0 hole-1)
     (binding-0 binding-1 hole-1 hole-0 hole-1)))
 (random-integer 4)
 (random-integer 20))

;; or in SRFI-26:

(let ((hole-value-0 (random-integer 4))
      (hole-value-1 (random-integer 20)))
  ((cute list (random-real) <> <> <>)
   hole-value-1
   hole-value-0
   hole-value-1))

;; The `cut` equivalent would be called `cutr` and this invocation:

((cutr list (random-real) <1> <0> <1>)
 (random-integer 4)
 (random-integer 20))

;; would have the same effect as:

((lambda (hole-0 hole-1)
   (list (random-real) hole-1 hole-0 hole-1))
 (random-integer 4)
 (random-integer 20))

;; or in SRFI-26:

(let ((hole-0-value (random-integer 4))
      (hole-1-value (random-integer 20)))
  ((cut list (random-real) <> <> <>)
   hole-1-value
   hole-0-value
   hole-1-value))
```

I think it's best when all holes `0` up to and including `N-1` must be
present at least once when invoking the macro, i.e. after the `cutr`
or `cuter` keyword.  If not all numbers between `0` and `N-1` are
used, the arguments at those hole positions would be dropped each time
the specialised procedure is used, and I can think of no reason to
have that behaviour.

Additionally, the names of these two macros are very similar to
SRFI-26's names, and as much as I love wordplay, it may result in
confusion, so new names are needed.

Also additionally, this might be a bit of a spam SRFI.  I don't think
it is very important, but I had to write it down publicly for you to
judge and maybe tell me what to do to get it SRFI-ed if you deem it
worthy.

Anyway, I have a repository up on Codeberg[1].  Its README.md file is
not up-to-date, but I've committed today an almost complete `cuter`
macro, lacking only the `<...>` keyword you can find in SRFI-26.  It
is also not good code and it is almost completely not tested.

[1]: https://codeberg.org/kakafarm/srfi-26-cuter