[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pretty-lambdas

   From: kragen@pobox.com (Kragen Sitaker)
   To: ll1-discuss@ai.mit.edu
   Subject: Re: pretty-lambdas
   Date: Thu, 28 Nov 2002 03:13:27 -0500 (EST)
   Luke Gorrie writes:
   > I just want to mention a simple and good-enough-for-me solution to the
   > "lambda is too many characters" problem: have Emacs "fontify" the
   > string "lambda" as a lambda character. Then it uses less screen space
   > even than 'fn'.
   Thank you very much for forwarding this tidbit; it delights me.
   > You need to have an appropriate font installed - more on that in the
   > usenet thread that comes up first on a search for "pretty lambda" at
   > groups.google.com. I don't know if this works on Emacsen other than
   > GNU version 21.
   It doesn't work in "21.4 (patch 6) "Common Lisp" XEmacs Lucid", but it
   does indeed work in GNU Emacs 21.  (My Greek font looks hideous,
   I still think (\ (x) (format t "~A~%" x)) takes too much space to
   remove the need for macros like 'dolist'.  Compare:
   (dolist (x list) (format t "~A~%" x))
   (mapcar (lambda (x) (format t "~A~%" x)) list)  ; too verbose
   (mapcar (\ (x) (format t "~A~%" x)) list)       ; still too verbose
   (mapcar {format t "~A~%" #1} list )    ; Mathematica's lambda syntax
   mapcar (format t "~A~%") list          ; in almost-ML

Or, in Connection Machine Lisp:

   @(format t "~A~%" !list)

(Which only helps with this particular example, but mapcar/dolist
is a pretty common operation.  Think of @ and ! as being like
` and , syntactically; @ means roughly "do this a lot" and ! means
"except here; this is a list; use its elements, once each".
Actually CM-Lisp used alpha and center-dot characters, but this
gives you the idea.)