On Sun, May 04, 2014 at 03:00:52PM -0400, John Cowan wrote:
> Peter Bex scripsit:
> 
> > > What's a good predicate to use to check whether what will be passed to
> > > alist-ref will not throw an exception?
> > 
> > I don't understand the question.
> 
> See the post I just sent for such a predicate.

Thanks.

> > No, the check only checks while it's cdring down the list, so it will
> > only error when it encounters an improper list tail.  so it's still O(n)
> > instead of O(2n), which it would've been if it first checked the entire
> > list.
> 
> O(n) and O(2n) are the same thing, because big-O notation eliminates
> any constant factor such as this.

Yeah.  I was attempting to explain that it's not O(n) due to traversing
the list separately for checking, but "naturally".

Cheers,
Peter
-- 
http://www.more-magic.net

_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to