From: Joachim
Subject: let
Date: 
Message-ID: <S6Fd4.10562$c6.501396@news.chello.at>
Hi!

I have a Problem with a lisp exercise. The problem is:

I have a lisp-dialekt without a let. Now the challenge is, to implement a
macro mylet that works similar. The binding should be done with a nameless
(lambda) function.

Thank you for any ideas!

Joachim

From: Stig Hemmer
Subject: Re: let
Date: 
Message-ID: <ekviu14d2ub.fsf@epoksy.pvv.ntnu.no>
"Joachim" <········@fbma.tuwien.ac.at> writes:
> I have a lisp-dialekt without a let. Now the challenge is, to implement a
> macro mylet that works similar. The binding should be done with a nameless
> (lambda) function.

Like any macro exercise, this one has two parts.

1) figuring out how the macro expansion should look.

2) writing a macro definition that makes that expansion.

In this case:

1)  What should this look like after macro expansion?
  (mylet ((x 5) (y 6))
     (frobnicate x y))

2) How do you write a macro definition that achieves that?

3) Once everything else is in place, start thinking about LET
   variables without initial values.  For example,
  (mylet ((x 5) y)
     (frobnicate x y))
   should work the same as
  (mylet ((x 5) (y nil))
     (frobnicate x y))

So, which part is causing you problems?

Stig Hemmer,
Jack of a Few Trades.
From: Tim Bradshaw
Subject: Re: let
Date: 
Message-ID: <ey3so08yb7m.fsf@cley.com>
* Joachim  wrote:
> Hi!
> I have a Problem with a lisp exercise. The problem is:

> I have a lisp-dialekt without a let. Now the challenge is, to implement a
> macro mylet that works similar. The binding should be done with a nameless
> (lambda) function.

It's hard to answer this without giving the answer, but this might
give a clue as to the kind of construct you're looking for.

(defmacro for ((var list) &body code)
  `(map nil #'(lambda (,var)
		,@code)
	,list))

--tim