Named lambda? Artyom Bologov (05 Aug 2026 23:36 UTC)
Re: Named lambda? Vladimir Nikishkin (05 Aug 2026 23:49 UTC)
Re: Named lambda? Peter McGoron (06 Aug 2026 00:03 UTC)
Re: Named lambda? Shawn Wagner (06 Aug 2026 00:04 UTC)
Re: Named lambda? Alex Shinn (06 Aug 2026 00:42 UTC)
Re: Named lambda? Artyom Bologov (06 Aug 2026 00:47 UTC)
Re: Named lambda? Wolfgang Corcoran-Mathe (06 Aug 2026 01:23 UTC)

Named lambda? Artyom Bologov 05 Aug 2026 23:35 UTC

Hi y’all,

So, in Clojure world, it’s a (rare yet existent) practice to use named
lambdas. However oxymoronic that might seem, it eases debugging and
inspection of these due to attached names and stacktraces, without
sacrificing the throwaway nature of lambdas. Now, would not it be nice
to have that in Scheme too?

(This idea was brought to you by Chibi throwing context-less
#<procedure #f 0> in errors at me for the fifth time this evening.)

Clojure syntax is:

  (fn name [args...] body...)

But that won’t work in Scheme, as the first symbol will be interpreted
as rest argument:

  (lambda name (actual-args...) body...) ;; No!

So there’s a need for better syntax. My initial idea was to use quoted
name in the argument list:

  (lambda ('name args...) body...)

However, this does not work with single rest argument either.

  (lambda 'name args #;What?)

First question: do we need that as an SRFI? (I do!)
Second question: ideas for syntax?

Best of luck,
--
Artyom Bologov
https://aartaka.me