I've searched the web but I can not find an example of creating a
local variable within loop initially clause. Basically I want to
transfer let form into LOOPs initially or somewher in the middle of
it:
(let (x)
(loop for i in '(1 2 3 4) do (push i x)
finally (return x)))
(4 3 2 1)
(loop initially (let (x))
for i in '(1 2 3 4) do (push i x)
finally (return x))
Error: Attempt to take the value of the unbound variable `X'.
[condition type: UNBOUND-VARIABLE]
Is this possible?
thanks
Slobodan
Slobodan Blazeski escribi�:
> I've searched the web but I can not find an example of creating a
> local variable within loop initially clause.
Hi Slobodan,
Have you read Practical Common Lisp? If you didn't, get it and read
chapter 22.
Leandro
On Nov 1, 2:41 am, Leandro Rios <··················@gmail.com> wrote:
> Slobodan Blazeski escribi�:
>
> > I've searched the web but I can not find an example of creating a
> > local variable within loop initially clause.
>
> Hi Slobodan,
>
> Have you read Practical Common Lisp? If you didn't, get it and read
> chapter 22.
>
> Leandro
Yes I read chapter 22, but I didn't used loop because it looked so
unlispy to me, now I'm starting to change my opinion. Beside there's
no Initially and finally examples in PCL just description, and quite
few in the web. This examples helped me understand how to use those
constructs http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node252.html
http://www.lispworks.com/documentation/lcl50/loop/loop-48.html if you
have some other resources of using them, especiallu something more
complicated please consider sharing it.
cheers
Slobodan
especially something more complicated I would like to
On Nov 1, 10:16 am, Slobodan Blazeski <·················@gmail.com>
wrote:
> Yes I read chapter 22, but I didn't used loop because it looked so
> unlispy to me, now I'm starting to change my opinion. Beside there's
> no Initially and finally examples in PCL just description, and quite
> few in the web. This examples helped me understand how to use those
> constructshttp://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node252.htmlhttp://www.lispworks.com/documentation/lcl50/loop/loop-48.htmlif you
> have some other resources of using them, especiallu something more
> complicated please consider sharing it.
You may want to take a look at ITERATE (it's even ASDF-INSTALlable).
It is something very similar to LOOP, but more lispy and whith code
that's a lot easier to understand and maintain. I tried it and never
wanted to get back to loop again
Bests,
-- Richard.
"Slobodan Blazeski" <·················@gmail.com> wrote in message
·····························@v3g2000hsg.googlegroups.com...
> I've searched the web but I can not find an example of creating a
> local variable within loop initially clause. Basically I want to
> transfer let form into LOOPs initially or somewher in the middle of
> it:
You want the <with> clause.
It's Halloween night here in NYC. Is this trick or treat?
Carl Taylor
CL-USER 1 >
(loop with x = '()
for i in '(1 2 3 4)
do (push i x)
finally (return x))
(4 3 2 1)
On Oct 31, 5:20 pm, "Carl Taylor" <··········@att.net> wrote:
> "Slobodan Blazeski" <·················@gmail.com> wrote in message
>
> ·····························@v3g2000hsg.googlegroups.com...
>
> > I've searched the web but I can not find an example of creating a
> > local variable within loop initially clause. Basically I want to
> > transfer let form into LOOPs initially or somewher in the middle of
> > it:
>
> You want the <with> clause.
>
> It's Halloween night here in NYC. Is this trick or treat?
Carl help yourself http://www.spencecandies.com/images/giftbskt.jpg :)
>
> Carl Taylor
>
> CL-USER 1 >
> (loop with x = '()
> for i in '(1 2 3 4)
> do (push i x)
> finally (return x))
> (4 3 2 1)
Great thanks, I feel like I'm learning a completely new language in
Frog way.
But it's one more improvement, now I only need to find how to collect
all the values of the hash table more concisely to get closer to
Haskell solution.
cheers
Slobodan