On Sun, May 04, 2014 at 01:52:06PM +0100, Andy Bennett wrote: > Hi, > > > + (assert-error (alist-ref 'foo 'bar cmp)) > > + (assert-error (alist-ref 'foo '(bar) cmp))) > > 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. > The 2nd assert-error rules out a simple list? or an O(1) algorithm. > (Tho' list? is already O(n)). 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. Cheers, Peter -- http://www.more-magic.net _______________________________________________ Chicken-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-users
