From: Rahul Jain
Subject: translating loop while # do (return #) to SERIES
Date: 
Message-ID: <877kr4l6yi.fsf@photino.sid.rice.edu>
I have some loop code that looks sort of like:
(loop
    ...
    while ... do (return ...)
    ...
    finally do (return ...))

I've been learning SERIES and was wondering how to get the SERIES code
to do the same "short-circuiting" as I have LOOP doing. I've thought
about using LATCH and UNTIL, but there seem to be off-by-one issues
which might hurt the efficiency of the SERIES implementation relative
to the LOOP implementation. I already have a working solution, but it
doesn't short-circuit, so it takes FAR longer than the LOOP
implementation. (The final result is a boolean, so I just use
COLLECT-LAST and MAP-FN with AND.)

Any ideas from people who use SERIES?

-- 
-> -/-                       - Rahul Jain -                       -\- <-
-> -\- http://linux.rice.edu/~rahul -=- ·················@usa.net -/- <-
-> -/- "I never could get the hang of Thursdays." - HHGTTG by DNA -\- <-
|--|--------|--------------|----|-------------|------|---------|-----|-|
   Version 11.423.999.220020101.23.50110101.042
   (c)1996-2000, All rights reserved. Disclaimer available upon request.

From: Kent M Pitman
Subject: Re: translating loop while # do (return #) to SERIES
Date: 
Message-ID: <sfwitaocm9r.fsf@shell01.TheWorld.com>
Rahul Jain <·····@sid-1129.sid.rice.edu> writes:

> I have some loop code that looks sort of like:
> (loop
>     ...
>     while ... do (return ...)

Are you sure you don't mean WHEN here?  This loop looks like it will be
over the first time this condition is met.  WHILE is usually for something
to happen more than once and an unconditional RETURN assures that it can't
happen more than once.

>     ...
>     finally do (return ...))
> 
> I've been learning SERIES and was wondering how to get the SERIES code
> to do the same "short-circuiting" as I have LOOP doing. I've thought
> about using LATCH and UNTIL, but there seem to be off-by-one issues
> which might hurt the efficiency of the SERIES implementation relative
> to the LOOP implementation. I already have a working solution, but it
> doesn't short-circuit, so it takes FAR longer than the LOOP
> implementation. (The final result is a boolean, so I just use
> COLLECT-LAST and MAP-FN with AND.)
> 
> Any ideas from people who use SERIES?

I haven't used SERIES in a long time so have no comment on this part.
From: Lieven Marchand
Subject: Re: translating loop while # do (return #) to SERIES
Date: 
Message-ID: <m3r8pbp5p5.fsf@localhost.localdomain>
Rahul Jain <·····@sid-1129.sid.rice.edu> writes:

> I have some loop code that looks sort of like:
> (loop
>     ...
>     while ... do (return ...)
>     ...
>     finally do (return ...))
> 
> I've been learning SERIES and was wondering how to get the SERIES code
> to do the same "short-circuiting" as I have LOOP doing. I've thought
> about using LATCH and UNTIL, but there seem to be off-by-one issues
> which might hurt the efficiency of the SERIES implementation relative
> to the LOOP implementation. I already have a working solution, but it
> doesn't short-circuit, so it takes FAR longer than the LOOP
> implementation. (The final result is a boolean, so I just use
> COLLECT-LAST and MAP-FN with AND.)
> 
> Any ideas from people who use SERIES?

I don't have a concrete solution but questions like this is why I've
stopped using SERIES and similar things.

SERIES code can be very concise and beautiful if the problem is well
fitted to it and regular. But the moment there's a bit of irregularity
it becomes hard to adapt. The same is true of very involved DO's. LOOP
generally can handle irregular (real world) problems.

-- 
Lieven Marchand <···@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