Re: λ notation
- From: levy <levente.meszaros@xxxxxxxxx>
- Date: Wed, 20 Feb 2008 01:01:04 -0800 (PST)
Here are some of my ideas:
;; this is a simple macro
(mapcar (λ (α) (+ α 10)) '(1 2 3 4))
;; this can be done with a reader macro
(mapcar Λ(+ α 10) '(1 2 3 4)) ;; greek characters are implicit
arguments in alphabetical order
;; this can also be done with a macro
(mapcar (« + 10) '(1 2 3 4)) ;; where '«' is like curry
;; this kind of compose implicitly takes function names as arguments
;; probably needs to be done after read and before compile by
processing the contents recursively
;; CL is not flexible enough to be able to implement easily such
syntax extensions
(find element list :key (a ° b ° c))
;; these are easy
(≠ 1 2)
(≤ 1 3)
(√ 16)
(Σ '(1 2 3 4))
(Π '(1 2 3 4))
;; recursive calls
(defun gcd (a b)
(if (= b 0)
a
(if (< a b)
(↻ b a)
(↻ b (mod a b)))))
and many more...
To type in a greek character one can either type 'lambda' and let
emacs replace it by 'λ' or bind it to a key such as C-l with an
appropriate prefix. It is also possible to type in 'lambda' and let
emacs display it as 'λ' even though the file contains the word
'lambda'. The other special characters could be handled similarily.
And as soon as we forget about storing and editing the code as simple
text files this whole notation issue becomes a matter of taste/
preference per user per session per whatever you want...
levy
.
- Follow-Ups:
- Re: notation
- From: Alex Mizrahi
- Re: λ notation
- From: Mirko . Vukovic
- Re: notation
- References:
- λ notation
- From: John Thingstad
- λ notation
- Prev by Date: Re: Paul Graham's Arc is released today... what is the long term impact?
- Next by Date: Re: Paul Graham's Arc is released today... what is the long term impact?
- Previous by thread: λ notation
- Next by thread: Re: λ notation
- Index(es):
Relevant Pages
|