chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Chicken C interface


From: Thomas Chust
Subject: Re: [Chicken-users] Chicken C interface
Date: Wed, 05 Jun 2013 19:57:49 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6

On 2013-06-05 19:50, Peter Bex wrote:
> [...]
> There is no C_listp predicate because you can't directly check an
> object for being a list; you must check whether it's
> C_SCHEME_END_OF_LIST (then it is a list).  Otherwise, if it's a pair
> you take its cdr and loop.  If it's something else, it's not a list.
> 
> Because this is a potentially heavy operation (and cyclic lists may
> even cause an endless loop), I guess it's been decided not to provide
> a predicate procedure for this,
> [...]

Hello,

but it's trivial to detect cyclic lists during the traversal using
either a set of seen elements or just two iteration pointers travelling
at different speeds.

The only problematic structures are truly infinite lists without
periodicity, but those are impossible with eager data structures like
the standard Scheme lists.

Ciao,
Thomas


-- 
When C++ is your hammer, every problem looks like your thumb.


-- 
When C++ is your hammer, every problem looks like your thumb.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]