Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

(let (flet (multiple-value-bind (etc.))))

24 views
Skip to first unread message

Software Scavenger

unread,
Dec 29, 2001, 9:18:16 AM12/29/01
to
I'm wondering about a more powerful version of let, to combine the
functionality of let, flet, multiple-value-bind, etc. It seems like
it would be nice to be able to unfold the bindings into one long form
instead of deeply nesting them. Does such a beast already lurk in
some dark corner of the universe, waiting for unwary adventurers to
discover it, or is this something I would have to create from scratch
to experiment with it?

Thomas F. Burdick

unread,
Dec 29, 2001, 1:57:01 PM12/29/01
to
cubic...@mailandnews.com (Software Scavenger) writes:

How on earth would you propose the syntax of such a horror to work?
The most reasonable syntax I can think of is:

(Łet* ((a (foo))
(#'b (x) (* x a))
(c (b (bar)))
((values d d?) (gethash c *hash*)))
...)

But that is disgusting! Maybe a multiple-value-let, like:

(mv-let* ((a (foo))
(b (bar a))
((c c?) (gethash b *hash*)))
...)

would be useful and readable. Honestly, it's a very rare event when I
have to nest at all deeply because of switching between let, flet, and
m-v-bind. In those cases (you're probably not going to like my
solution :) I just make my Emacs frame really big. My lines aren't
any longer than normal, they just start significantly to the right of
normal. Eww, to get either of these to work, your macro will have to
completely parse declarations so it can stick them to the correct
form.

--
/|_ .-----------------------.
,' .\ / | No to Imperialist war |
,--' _,' | Wage class war! |
/ / `-----------------------'
( -. |
| ) |
(`-. '--.)
`. )----'

Lieven Marchand

unread,
Dec 29, 2001, 1:46:24 PM12/29/01
to
cubic...@mailandnews.com (Software Scavenger) writes:

It comes up fairly often in c.l.l. Google for LETBIND and friends.

--
Lieven Marchand <m...@wyrd.be>
She says, "Honey, you're a Bastard of great proportion."
He says, "Darling, I plead guilty to that sin."
Cowboy Junkies -- A few simple words

Erik Naggum

unread,
Dec 29, 2001, 4:00:12 PM12/29/01
to
* cubic...@mailandnews.com (Software Scavenger)

| I'm wondering about a more powerful version of let, to combine the
| functionality of let, flet, multiple-value-bind, etc.

There are about as many of these as there are Scheme implementations.
However useful they seem before you start to write it, it is quickly
abandoned because in fact it is not particularly useful -- instead of
being written once and for all, you tinker with it so much there is never
any actual savings, especially since every Common Lisp programmer you
might want to share code with has his own version of such a macro.

///
--
The past is not more important than the future, despite what your culture
has taught you. Your future observations, conclusions, and beliefs are
more important to you than those in your past ever will be. The world is
changing so fast the balance between the past and the future has shifted.

0 new messages