Email list hosting service & mailing list manager

Unicode lambda Lassi Kortela (12 May 2019 10:19 UTC)
Re: Unicode lambda Shiro Kawai (12 May 2019 11:18 UTC)
Re: Unicode lambda Lassi Kortela (12 May 2019 11:40 UTC)
Re: Unicode lambda Lassi Kortela (12 May 2019 11:50 UTC)
Re: Unicode lambda Shiro Kawai (12 May 2019 12:06 UTC)
Re: Unicode lambda Marc Nieper-Wißkirchen (12 May 2019 12:11 UTC)
Re: Unicode lambda Lassi Kortela (12 May 2019 12:23 UTC)
Re: Unicode lambda Lassi Kortela (12 May 2019 13:23 UTC)
Re: Unicode lambda Lassi Kortela (12 May 2019 13:46 UTC)
Re: Unicode lambda John Cowan (12 May 2019 14:20 UTC)
Re: Unicode lambda Lassi Kortela (12 May 2019 14:38 UTC)
Re: Unicode lambda Lassi Kortela (12 May 2019 14:55 UTC)
Re: Unicode lambda John Cowan (12 May 2019 15:00 UTC)
Re: Unicode lambda Lassi Kortela (12 May 2019 15:20 UTC)
Re: Unicode lambda Shiro Kawai (12 May 2019 18:42 UTC)
Re: Unicode lambda Lassi Kortela (12 May 2019 19:43 UTC)
Re: Unicode lambda John Cowan (12 May 2019 22:29 UTC)
Re: Unicode lambda Shiro Kawai (13 May 2019 10:48 UTC)
Re: Unicode lambda Lassi Kortela (14 May 2019 08:25 UTC)
Re: Unicode lambda Marc Nieper-Wißkirchen (14 May 2019 08:50 UTC)
Re: Unicode lambda Lassi Kortela (14 May 2019 10:10 UTC)
Re: Unicode lambda Lassi Kortela (14 May 2019 10:59 UTC)
Re: Unicode lambda Lassi Kortela (14 May 2019 12:35 UTC)
Re: Unicode lambda Lassi Kortela (14 May 2019 13:09 UTC)
Re: Unicode lambda Lassi Kortela (14 May 2019 14:04 UTC)
Re: Unicode lambda Shiro Kawai (14 May 2019 19:18 UTC)
Re: Unicode lambda Vincent Manis (14 May 2019 22:01 UTC)
Re: Unicode lambda Lassi Kortela (20 May 2019 09:21 UTC)
Re: Unicode lambda Marc Nieper-Wißkirchen (21 Oct 2019 14:20 UTC)
Re: Unicode lambda Shiro Kawai (21 Oct 2019 17:19 UTC)
Re: Unicode lambda John Cowan (21 Oct 2019 17:39 UTC)
Re: Unicode lambda Marc Nieper-Wißkirchen (21 Oct 2019 18:43 UTC)
Re: Unicode lambda John Cowan (21 Oct 2019 23:27 UTC)
Encoding declarations Lassi Kortela (22 Oct 2019 08:39 UTC)
Re: Encoding declarations John Cowan (22 Oct 2019 20:52 UTC)
#! directives, general and specific Lassi Kortela (22 Oct 2019 09:11 UTC)
Re: #! directives, general and specific John Cowan (22 Oct 2019 20:27 UTC)
Re: #! directives, general and specific Lassi Kortela (22 Oct 2019 20:43 UTC)
Re: Unicode lambda Marc Nieper-Wißkirchen (13 May 2019 08:50 UTC)
Re: Unicode lambda Lassi Kortela (13 May 2019 10:27 UTC)
Re: Unicode lambda Per Bothner (12 May 2019 14:17 UTC)
Re: Unicode lambda Peter (12 May 2019 15:06 UTC)

Unicode lambda Lassi Kortela 12 May 2019 10:19 UTC

Has there been discussion of permitting Unicode lambda in Scheme source
code? I use it in Racket and I find that it makes code easier to read
since 'lambda' is quite a long identifier for something you write all
over the place. It's especially nice for making two-line lambdas fit in
one line of code.

I tried this simple macro definition:

(define-syntax λ
   (syntax-rules ()
     ((_ rest ...)
      (lambda rest ...))))

And these tests:

((λ (x) (+ x 1)) 1)  ; => 2

(apply (λ xs (list xs)) 1 2 '(3 4 5))  ; => ((1 2 3 4 5))

Those work out of the box in Chez, Chibi, Chicken, Gauche and Kawa with
the default settings of those Schemes in a UTF-8 Unix terminal.

Unicode lambda is also the same single codepoint under all Unicode
normalization forms, so no aliasing problems there.

(Fun fact: if you type λ in Emacs and then press M-u to uppercase it, it
turns into Λ logically enough.)

I wonder if there's any Scheme implementation that does case folding so
you could use (Λ (x) x) as an alias for (λ (x) x). I would find it
hilarious, but I don't know if it's appropriate for mass consumption.
Most Schemes default to case-sensitive nowadays
(<http://practical-scheme.net/wiliki/schemexref.cgi?Concept%3ACaseSensitivity>).
At least Gauche's `gosh -fcase-fold` mode treats lowercase and uppercase
lambda as separate characters.

Apart from the above, source file encoding raises some concerns. I can't
find any mention in R6RS or R7RS that source code has to be UTF-8 or
Unicode in general. FWIW, the Go language mandates UTF-8. Obviously we
can't change R6RS and R7RS-small (and perhaps not even R7RS-large) to
require UTF-8 at this stage, but if there's a Unicode-lambda SRFI then
that SRFI could perhaps make such a demand for files that import it.

There are also various hacks to render the word "lambda" as the Greek
letter in Emacs: <https://www.emacswiki.org/emacs/PrettyLambda>.
Nowadays it's as simple as doing M-x prettify-symbols-mode. I don't know
if there are unintended side effects to this - I can imagine that in
some situations you'd want to keep some symbols as 'lambda' and only
have our beloved abstraction operator use the Greek letter. For example,
prettify-symbols-mode renders (lambda 'lambda lambda 'lambda lambda) as
a list of five Greek lambdas.