[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Question about the implementation of list?
From: |
John Cowan |
Subject: |
Re: [Chicken-users] Question about the implementation of list? |
Date: |
Fri, 7 Mar 2014 13:47:20 -0500 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Daniel Carrera scripsit:
> Does this mean that "list?" is O(n) on the list length? In other words, you
> cannot know whether a pair is a list until you have visited every node all
> the way to the end, till you hit '().
Correct. If you want an O(1) but somewhat unreliable predicate, use
(lambda (x) (or (null? x) (pair? x))).
--
Where the wombat has walked, John Cowan <address@hidden>
it will inevitably walk again. http://www.ccil.org/~cowan
(even through brick walls!)