Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Most impressive examples of the LOOP macro
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 34 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Tron3k  
View profile  
 More options Jul 19 2005, 7:04 pm
Newsgroups: comp.lang.lisp
From: "Tron3k" <tro...@gmail.com>
Date: 19 Jul 2005 16:04:03 -0700
Local: Tues, Jul 19 2005 7:04 pm
Subject: Most impressive examples of the LOOP macro
Greetings fellow Common Lispers.

As some of you may know I am developing a new variant of Lisp. I am
currently figuring out iteration constructs. In particular, I am
experimenting with a method of iteration that iterates in parallel over
several lazy sequences, stopping when any of them terminates. I have
found this useful to replace several uses of the LOOP macro in my code.
However, I know the LOOP macro is too powerful for any one man to
comprehend. Hence, I request that you post the most impressive,
succinct, and elegant examples of the LOOP macro in action, so that I
can use them as goalposts for my language's iteration constructs.

Here's one of mine (I invented this one myself):

; Prints the first 16 rows of Pascal's triangle
; not tested, I'm writing it from memory right here!
(loop repeat 16
      for list = '(1) then (mapcar #'+ (cons 0 list) (append list
'(0)))
      do (format t "~{~6D~^,~}~%" list))

That's definitely one of the most beautiful pieces of code I've ever
written. I wrote it for a programming language comparison contest, and
blew every other language out of the water, except Mathematica, of
course. ;-)

Tron3k


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal Costanza  
View profile  
 More options Jul 19 2005, 7:51 pm
Newsgroups: comp.lang.lisp
From: Pascal Costanza <p...@p-cos.net>
Date: Wed, 20 Jul 2005 01:51:50 +0200
Local: Tues, Jul 19 2005 7:51 pm
Subject: Re: Most impressive examples of the LOOP macro

Tron3k wrote:
> Greetings fellow Common Lispers.

> As some of you may know I am developing a new variant of Lisp. I am
> currently figuring out iteration constructs. In particular, I am
> experimenting with a method of iteration that iterates in parallel over
> several lazy sequences, stopping when any of them terminates. I have
> found this useful to replace several uses of the LOOP macro in my code.
> However, I know the LOOP macro is too powerful for any one man to
> comprehend. Hence, I request that you post the most impressive,
> succinct, and elegant examples of the LOOP macro in action, so that I
> can use them as goalposts for my language's iteration constructs.

These requests have been made in the past for some other projects.
Googling in the archives of comp.lang.lisp should give you some ideas.

Pascal

--
2nd European Lisp and Scheme Workshop
July 26 - Glasgow, Scotland - co-located with ECOOP 2005
http://lisp-ecoop05.bknr.net/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matthias Buelow  
View profile  
 More options Jul 19 2005, 8:21 pm
Newsgroups: comp.lang.lisp
From: Matthias Buelow <m...@incubus.de>
Date: Wed, 20 Jul 2005 02:21:49 +0200
Local: Tues, Jul 19 2005 8:21 pm
Subject: Re: Most impressive examples of the LOOP macro

"Tron3k" <tro...@gmail.com> writes:
>That's definitely one of the most beautiful pieces of code I've ever
>written.

Warning: slippery slope.

mkb.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tron3k  
View profile  
 More options Jul 20 2005, 12:37 am
Newsgroups: comp.lang.lisp
From: "Tron3k" <tro...@gmail.com>
Date: 19 Jul 2005 21:37:32 -0700
Local: Wed, Jul 20 2005 12:37 am
Subject: Re: Most impressive examples of the LOOP macro

Thanks. I did, in fact, google for cool Lisp snippets before posting
this and found some interesting ones such as the one that prints the
Mandelbrot set using ASCII characters. I just thought that it would be
fun to have a thread for everyone to share the cool snippets they have
tucked away ... I've done this on other forums and people usually enjoy
it.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tron3k  
View profile  
 More options Jul 20 2005, 12:38 am
Newsgroups: comp.lang.lisp
From: "Tron3k" <tro...@gmail.com>
Date: 19 Jul 2005 21:38:35 -0700
Local: Wed, Jul 20 2005 12:38 am
Subject: Re: Most impressive examples of the LOOP macro

Matthias Buelow wrote:
> "Tron3k" <tro...@gmail.com> writes:

> >That's definitely one of the most beautiful pieces of code I've ever
> >written.

> Warning: slippery slope.

> mkb.

???

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paolo Amoroso  
View profile  
 More options Jul 20 2005, 3:38 am
Newsgroups: comp.lang.lisp
From: Paolo Amoroso <amor...@mclink.it>
Date: Wed, 20 Jul 2005 09:38:45 +0200
Local: Wed, Jul 20 2005 3:38 am
Subject: Re: Most impressive examples of the LOOP macro

"Tron3k" <tro...@gmail.com> writes:
> currently figuring out iteration constructs. In particular, I am
> experimenting with a method of iteration that iterates in parallel over
> several lazy sequences, stopping when any of them terminates. I have
> found this useful to replace several uses of the LOOP macro in my code.

I also have a way of replacing uses of LOOP: MACROEXPAND.

Paolo
--
Why Lisp? http://lisp.tech.coop/RtL%20Highlight%20Film
Recommended Common Lisp libraries/tools:
- ASDF/ASDF-INSTALL: system building/installation
- CL-PPCRE: regular expressions
- UFFI: Foreign Function Interface


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Timofei Shatrov  
View profile  
 More options Jul 20 2005, 4:42 am
Newsgroups: comp.lang.lisp
From: g...@mail.ru (Timofei Shatrov)
Date: Wed, 20 Jul 2005 08:42:13 GMT
Local: Wed, Jul 20 2005 4:42 am
Subject: Re: Most impressive examples of the LOOP macro
On 19 Jul 2005 16:04:03 -0700, "Tron3k" <tro...@gmail.com> tried to
confuse everyone with this message:

>Greetings fellow Common Lispers.

>As some of you may know I am developing a new variant of Lisp. I am
>currently figuring out iteration constructs. In particular, I am
>experimenting with a method of iteration that iterates in parallel over
>several lazy sequences, stopping when any of them terminates. I have
>found this useful to replace several uses of the LOOP macro in my code.
>However, I know the LOOP macro is too powerful for any one man to
>comprehend. Hence, I request that you post the most impressive,
>succinct, and elegant examples of the LOOP macro in action, so that I
>can use them as goalposts for my language's iteration constructs.

Here is one neat loop I wrote. Not very efficient, though...

;Continous fractions: 47/350 -> (0 (1 3) (4 2 8 5 7 1))
(defun contdivstuff (a b &key (base 10))
  (multiple-value-bind (whole r) (floor (/ a b))
  (loop for tr = (* base r) then (* base (- tr (floor tr)))
        for tail = (member tr past)
        until tail
        collecting tr into past
        finally (return (list whole (mapcar #'floor (ldiff past tail))
                              (mapcar #'floor tail))))))

--
|a\o/r|,-------------.,---------- Timofei Shatrov aka Grue ------------.
| m"a ||FC AMKAR PERM|| mail: grue at mail.ru  http://grue3.tripod.com |
|  k  ||  PWNZ J00   || Kingdom of Loathing: Grue3 lvl 18 Seal Clubber |
`-----'`-------------'`-------------------------------------------[4*72]


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tron3k  
View profile  
 More options Jul 20 2005, 10:13 am
Newsgroups: comp.lang.lisp
From: "Tron3k" <tro...@gmail.com>
Date: 20 Jul 2005 07:13:50 -0700
Local: Wed, Jul 20 2005 10:13 am
Subject: Re: Most impressive examples of the LOOP macro

Paolo Amoroso wrote:
> "Tron3k" <tro...@gmail.com> writes:

> > currently figuring out iteration constructs. In particular, I am
> > experimenting with a method of iteration that iterates in parallel over
> > several lazy sequences, stopping when any of them terminates. I have
> > found this useful to replace several uses of the LOOP macro in my code.

> I also have a way of replacing uses of LOOP: MACROEXPAND.

Its expansion is hideous, but I don't think that's what you meant.

You're saying that it's stupid to hate a tool if it works. You're
fitting me into your pre-existing archetype of the mindless anti-LOOP
bigot. Well, there are reasons I'm not going to translate all the code
for LOOP into my new Lisp. First of all, it would be hard to get right.
Second of all, I'm trying to make this language simple to implement,
since as PG says, source code is often the best spec. So I'm trying to
find a good combination of simple but powerful constructs that are
equivalent in expressivity to LOOP.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pascal Costanza  
View profile  
 More options Jul 20 2005, 10:24 am
Newsgroups: comp.lang.lisp
From: Pascal Costanza <p...@p-cos.net>
Date: Wed, 20 Jul 2005 16:24:22 +0200
Local: Wed, Jul 20 2005 10:24 am
Subject: Re: Most impressive examples of the LOOP macro

I had your more specific request in mind, wrt examples using LOOP. There
were a number of examples posted in conjunction with LinJ.

Pascal

--
2nd European Lisp and Scheme Workshop
July 26 - Glasgow, Scotland - co-located with ECOOP 2005
http://lisp-ecoop05.bknr.net/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tron3k  
View profile  
 More options Jul 20 2005, 10:37 am
Newsgroups: comp.lang.lisp
From: "Tron3k" <tro...@gmail.com>
Date: 20 Jul 2005 07:37:00 -0700
Subject: Re: Most impressive examples of the LOOP macro

Fantastic! I actually found it:

http://groups-beta.google.com/group/comp.lang.lisp/browse_thread/thre...

This is like a gold mine! Thanks!

Tron3k


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paolo Amoroso  
View profile  
 More options Jul 20 2005, 10:42 am
Newsgroups: comp.lang.lisp
From: Paolo Amoroso <amor...@mclink.it>
Date: Wed, 20 Jul 2005 16:42:30 +0200
Local: Wed, Jul 20 2005 10:42 am
Subject: Re: Most impressive examples of the LOOP macro

"Tron3k" <tro...@gmail.com> writes:
> Paolo Amoroso wrote:
[...]
>> I also have a way of replacing uses of LOOP: MACROEXPAND.

> Its expansion is hideous, but I don't think that's what you meant.

> You're saying that it's stupid to hate a tool if it works. You're
> fitting me into your pre-existing archetype of the mindless anti-LOOP
> bigot. Well, there are reasons I'm not going to translate all the code

No.

Paolo
--
Why Lisp? http://lisp.tech.coop/RtL%20Highlight%20Film
Recommended Common Lisp libraries/tools:
- ASDF/ASDF-INSTALL: system building/installation
- CL-PPCRE: regular expressions
- UFFI: Foreign Function Interface


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Seibel  
View profile  
 More options Jul 20 2005, 12:56 pm
Newsgroups: comp.lang.lisp
From: Peter Seibel <pe...@gigamonkeys.com>
Date: Wed, 20 Jul 2005 16:56:29 GMT
Local: Wed, Jul 20 2005 12:56 pm
Subject: Re: Most impressive examples of the LOOP macro

"Tron3k" <tro...@gmail.com> writes:
> Here's one of mine (I invented this one myself):

> ; Prints the first 16 rows of Pascal's triangle
> ; not tested, I'm writing it from memory right here!
> (loop repeat 16
>       for list = '(1) then (mapcar #'+ (cons 0 list) (append list
> '(0)))
>       do (format t "~{~6D~^,~}~%" list))

> That's definitely one of the most beautiful pieces of code I've ever
> written. I wrote it for a programming language comparison contest,
> and blew every other language out of the water, except Mathematica,
> of course. ;-)

Hmmm. I'm not sure any code that repeatedly APPENDs to the end of a
growing list can be all that elegant. If you're into this sort of
thin, both the versions below, while slightly longer in terms of
number of characters than yours, are, I'd argue, algorithmically more
elegant:

  (loop repeat 16 for list = '(1)
     then (maplist #'(lambda (cons) (+ (car cons) (or (cadr cons) 0))) (cons 0 list))
     do (format t "~{~6D~^,~}~%" list))

  (loop repeat 16 for list = '(1)
     then (maplist #'(lambda (cons) (apply #'+ (ldiff cons (cddr cons)))) (cons 0 list))
     do (format t "~{~6D~^,~}~%" list))

-Peter

--
Peter Seibel           * pe...@gigamonkeys.com
Gigamonkeys Consulting * http://www.gigamonkeys.com/
Practical Common Lisp  * http://www.gigamonkeys.com/book/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Lewerin  
View profile  
 More options Jul 20 2005, 6:26 pm
Newsgroups: comp.lang.lisp
From: peter.lewe...@swipnet.se (Peter Lewerin)
Date: 20 Jul 2005 15:26:05 -0700
Local: Wed, Jul 20 2005 6:26 pm
Subject: Re: Most impressive examples of the LOOP macro

Peter Seibel <pe...@gigamonkeys.com> wrote:
> Hmmm. I'm not sure any code that repeatedly APPENDs to the end of a
> growing list can be all that elegant. If you're into this sort of
> thin, both the versions below, while slightly longer in terms of
> number of characters than yours, are, I'd argue, algorithmically more
> elegant:

>   (loop repeat 16 for list = '(1)
>      then (maplist #'(lambda (cons) (+ (car cons) (or (cadr cons) 0))) (cons 0 list))
>      do (format t "~{~6D~^,~}~%" list))

>   (loop repeat 16 for list = '(1)
>      then (maplist #'(lambda (cons) (apply #'+ (ldiff cons (cddr cons)))) (cons 0 list))
>      do (format t "~{~6D~^,~}~%" list))

Maybe even

    (loop repeat 16
        for list = '(1)
        then (cons 1 (loop for (a b) on list
                         collecting (+ a (or b 0))))
        do (format t "~&~{~6D~^,~}~%" list))


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tron3k  
View profile  
 More options Jul 20 2005, 9:50 pm
Newsgroups: comp.lang.lisp
From: "Tron3k" <tro...@gmail.com>
Date: 20 Jul 2005 18:50:01 -0700
Local: Wed, Jul 20 2005 9:50 pm
Subject: Re: Most impressive examples of the LOOP macro

Yeah, I know. The contest was to create the shortest code though. :-)

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tron3k  
View profile  
 More options Jul 20 2005, 9:53 pm
Newsgroups: comp.lang.lisp
From: "Tron3k" <tro...@gmail.com>
Date: 20 Jul 2005 18:53:53 -0700
Local: Wed, Jul 20 2005 9:53 pm
Subject: Re: Most impressive examples of the LOOP macro

Paolo Amoroso wrote:
> "Tron3k" <tro...@gmail.com> writes:

> > Paolo Amoroso wrote:
> [...]
> >> I also have a way of replacing uses of LOOP: MACROEXPAND.

> > Its expansion is hideous, but I don't think that's what you meant.

> > You're saying that it's stupid to hate a tool if it works. You're
> > fitting me into your pre-existing archetype of the mindless anti-LOOP
> > bigot. Well, there are reasons I'm not going to translate all the code

> No.

Oh, so you were just wasting everyone's time with a thoroughly useless
comment. Ok then.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Don Geddis  
View profile  
 More options Jul 20 2005, 7:38 pm
Newsgroups: comp.lang.lisp
From: Don Geddis <d...@geddis.org>
Date: Wed, 20 Jul 2005 16:38:34 -0700
Local: Wed, Jul 20 2005 7:38 pm
Subject: Re: Most impressive examples of the LOOP macro
"Tron3k" <tro...@gmail.com> wrote on 20 Jul 2005 07:1:

> Well, there are reasons I'm not going to translate all the code for LOOP
> into my new Lisp. First of all, it would be hard to get right.

True.  Yet many CL programmers find it valuable that CL implementors spend
this effort.  I wonder if the programming community for your new language
will be as forgiving of you not bothering to put forth the effort.

> Second of all, I'm trying to make this language simple to implement

More and more, it sure sounds like you would be happier in the Scheme
community.  They share much of your aesthetic sense.  For example: Lisp-1,
small language spec, simple to implement, etc.

You sure don't sound like someone trying to improve Common Lisp.  You sound
like a Scheme guy who is trying to convert the "enemy".

> since as PG says, source code is often the best spec.

Leaving aside whether Paul Graham is the Prophet of Lisp, such that his
every word must become our law ... how is this even related?  "Source code
being the best spec" means that a sufficiently powerful language would allow
you to express most of what is usually in documentation, directly in the
language itself.

How does that have anything to do with whether the language is easy to
implement or not?

        -- Don
___________________________________________________________________________ ____
Don Geddis                  http://don.geddis.org/               d...@geddis.org
Writing about music is like dancing about architecture.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paolo Amoroso  
View profile  
 More options Jul 21 2005, 4:45 am
Newsgroups: comp.lang.lisp
From: Paolo Amoroso <amor...@mclink.it>
Date: Thu, 21 Jul 2005 10:45:41 +0200
Local: Thurs, Jul 21 2005 4:45 am
Subject: Re: Most impressive examples of the LOOP macro

"Tron3k" <tro...@gmail.com> writes:
>> > Paolo Amoroso wrote:
>> [...]
>> >> I also have a way of replacing uses of LOOP: MACROEXPAND.
[...]
> Oh, so you were just wasting everyone's time with a thoroughly useless
> comment. Ok then.

It was a joke.  As for wasting everyone's time, everyone can decide
for himself/herself.

Paolo
--
Why Lisp? http://lisp.tech.coop/RtL%20Highlight%20Film
Recommended Common Lisp libraries/tools:
- ASDF/ASDF-INSTALL: system building/installation
- CL-PPCRE: regular expressions
- UFFI: Foreign Function Interface


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
WJ  
View profile  
 More options Feb 28 2011, 2:34 pm
Newsgroups: comp.lang.lisp
From: "WJ" <w_a_x_...@yahoo.com>
Date: 28 Feb 2011 19:34:30 GMT
Local: Mon, Feb 28 2011 2:34 pm
Subject: Re: Most impressive examples of the LOOP macro

Guile Scheme:

(use-modules (ice-9 format)) ; CL-style format

(let recur ((lst '(1)))  (and (< (length lst) 17)
  (format #t "~{~6D~^,~}~%" lst)
  (recur (map + (cons 0 lst) (append lst '(0))))))


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
joswig@lisp.de  
View profile  
 More options Feb 28 2011, 4:48 pm
Newsgroups: comp.lang.lisp
From: "jos...@lisp.de" <jos...@lisp.de>
Date: Mon, 28 Feb 2011 13:48:46 -0800 (PST)
Local: Mon, Feb 28 2011 4:48 pm
Subject: Re: Most impressive examples of the LOOP macro
On 28 Feb., 20:34, "WJ" <w_a_x_...@yahoo.com> wrote:

Common Lisp:

(defmacro llet (name vars &body body)
  (let ((start-tag (gentemp)))
    `(prog ,vars
       ,start-tag
       (macrolet
           ((,name (&rest args)
              (append '(progn)
                      (loop for arg in args and var in ',vars
                            collect `(setq ,(if (consp var)
                                                (first var)
                                              var)
                                           ,arg))
                      (list (list 'go ',start-tag)))))
         (locally ,@body)))))

(llet recur ((list '(1)))
  (when (< (length list) 17)
    (format t "~{~6D~^,~}~%" list)
    (recur (mapcar '+ (cons 0 list) (append list '(0))))))


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
yuridichesky  
View profile  
 More options Mar 1 2011, 10:24 am
Newsgroups: comp.lang.lisp
From: yuridichesky <yuridiche...@gmail.com>
Date: Tue, 1 Mar 2011 07:24:30 -0800 (PST)
Local: Tues, Mar 1 2011 10:24 am
Subject: Re: Most impressive examples of the LOOP macro

jos...@lisp.de wrote:

[snip]

> (defmacro llet (name vars &body body)
[snip]

> (llet recur ((list '(1)))
>   (when (< (length list) 17)
>     (format t "~{~6D~^,~}~%" list)
>     (recur (mapcar '+ (cons 0 list) (append list '(0))))))

llet looks exactly like Scheme's named let.  Cool, that's what I miss
in CL.  Thanks.

- Yuri


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marco Antoniotti  
View profile  
 More options Mar 1 2011, 12:20 pm
Newsgroups: comp.lang.lisp
From: Marco Antoniotti <marc...@gmail.com>
Date: Tue, 1 Mar 2011 09:20:51 -0800 (PST)
Local: Tues, Mar 1 2011 12:20 pm
Subject: Re: Most impressive examples of the LOOP macro
On Mar 1, 4:24 pm, yuridichesky <yuridiche...@gmail.com> wrote:

Actually, it should expand into a LABELS to approach Scheme's
semantics.

 (defmacro nlet (name vars &body body)
   `(labels ((,name ,(mapcar 'first vars) ,@body))
       (,name ,@(mapcar 'second vars))))

It is an old macro.  Older than the original thread the SLDJ troll
responded to :)

cheers
--
MA


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
joswig@lisp.de  
View profile  
 More options Mar 1 2011, 12:39 pm
Newsgroups: comp.lang.lisp
From: "jos...@lisp.de" <jos...@lisp.de>
Date: Tue, 1 Mar 2011 09:39:42 -0800 (PST)
Local: Tues, Mar 1 2011 12:39 pm
Subject: Re: Most impressive examples of the LOOP macro
On Mar 1, 6:20 pm, Marco Antoniotti <marc...@gmail.com> wrote:

The idea was that it provides kind of a LOOP without need to support
TCO,
Thus no LABELS.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
yuridichesky  
View profile  
 More options Mar 1 2011, 2:18 pm
Newsgroups: comp.lang.lisp
From: yuridichesky <yuridiche...@gmail.com>
Date: Tue, 1 Mar 2011 11:18:13 -0800 (PST)
Local: Tues, Mar 1 2011 2:18 pm
Subject: Re: Most impressive examples of the LOOP macro

jos...@lisp.de wrote:
> The idea was that it provides kind of a LOOP without need to support
> TCO,
> Thus no LABELS.

Right, this is what I like the most.

- Yuri


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marco Antoniotti  
View profile  
 More options Mar 1 2011, 4:20 pm
Newsgroups: comp.lang.lisp
From: Marco Antoniotti <marc...@gmail.com>
Date: Tue, 1 Mar 2011 13:20:09 -0800 (PST)
Local: Tues, Mar 1 2011 4:20 pm
Subject: Re: Most impressive examples of the LOOP macro
On Mar 1, 6:39 pm, "jos...@lisp.de" <jos...@lisp.de> wrote:

Well, this day and age, I assume a good CL implementation *will*
provide TCO.  Besides, while it is true that Scheme named let is used
mostly for loops, you could use it in non-TCO settings.

(let fact ((x 4))
    (if (= x 0)
        1
        (* x (fact (- x 1)))))

The above is Scheme.

Cheers
--
Marco


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
joswig@lisp.de  
View profile  
 More options Mar 1 2011, 4:57 pm
Newsgroups: comp.lang.lisp
From: "jos...@lisp.de" <jos...@lisp.de>
Date: Tue, 1 Mar 2011 13:57:02 -0800 (PST)
Local: Tues, Mar 1 2011 4:57 pm
Subject: Re: Most impressive examples of the LOOP macro
On 1 Mrz., 22:20, Marco Antoniotti <marc...@gmail.com> wrote:

Does ABCL on the JVM??? Interpreted CLISP?

Also: it is possible that your code will be TCO, but not necessarily.
TCO in CL is tricky. It requires that the compiler runs in the right
mode, a compiler is used (does any CL interpreter do TCO) and a few
restrictions are not violated (say, dynamic bindings).


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Messages 1 - 25 of 34   Newer >
« Back to Discussions « Newer topic     Older topic »