Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

possible srfi-42 bug: while with lists
I sent this to the srfi-42 author a while ago, but haven't gotten a
reply yet. Maybe this list could enlighten me.

(my-check
(list-ec (:while (:range i 1 10) (< i 5)) i)
=> '(1 2 3 4) )

works fine.

(my-check
(list-ec (:while (:list i '(1 2 3 4 5 6 7 8 9 10)) (< i 5)) i)
=> '(1 2 3 4) )

Error.



Report this thread to moderator Post Follow-up to this message
Old Post
Sunnan
04-24-05 08:57 PM


Re: possible srfi-42 bug: while with lists
Sunnan wrote:
> I sent this to the srfi-42 author a while ago, but haven't gotten a
> reply yet. Maybe this list could enlighten me.
>
> (my-check
> (list-ec (:while (:range i 1 10) (< i 5)) i)
> => '(1 2 3 4) )
>
> works fine.
>
> (my-check
> (list-ec (:while (:list i '(1 2 3 4 5 6 7 8 9 10)) (< i 5)) i)
> => '(1 2 3 4) )
>
> Error.

It's a genuine bug in :while-1 of 'srfi.schemers.org/srfi-42/ec.scm'.

The problem is that the test (< i 5) is not in the right scope of the
generator (:range or :list) because it does not see the "inner
bindings" of the :do-loop the generator is transformed into. For :range
that does not result in an error because :range does not use inner
bindings. :List, however, does as it fetches the car of the residual
list.

A new version of 'ec.scm' and 'examples.scm' has been made available at
the srfi.schemers.org.

The fix is involved because :while-1 must modify a fully decorated
:do-loop into code incorporating the additional test, while preserving
all scopes. Refer to :while-1 in 'ec.scm' for details how I solved it.

Thanks for pointing out the bug!

Sebastian.


Report this thread to moderator Post Follow-up to this message
Old Post
sebastian_egner@yahoo.com
04-27-05 01:58 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Scheme archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:27 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.