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