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

list of alphas

This page is part of the web mail archives of SRFI 13 from before July 7th, 2015. The new archives for SRFI 13 contain all messages, not just those from before July 7th, 2015.

    > I suppose since you're walking the list anyway in lp, you could check it
    > inside the cond and get rid of the extra two traversals of the list (for
    > list? and ##every?).

    Scratch that comment; you still need to use something like list? to make
    sure that strings is a proper list, i.e., not circular.

Sounds like you need a little utility (proper-list-of? pred lis), returning
true iff LIS is a proper list, every element of which answers true to PRED.

Or perhaps a more general utility, (not-proper-list-of pred lis). Returns #f
if the list *is* a proper list of PRED elements. If some elt of the list fails
the PRED test, returns the sublist whose car is that elt. Returns 'infinite if
the list passes the PRED tests but is circular. Returns 'improper if the list
passes the PRED tests but is not nil-terminated. A lot more information for
the same amount of work.

I wouldn't use it, tho. Dynamically checking list elements is too much
trouble. This is where static type checking is your friend.