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

URGENT RESPONSE REQUESTED!!!!!



    One common problem I run into when #F == () is to distinguish
    between failure and an empty successful response,
    e.g. of a matcher or unifyer.  [Plug for failure semantics ... :-)]

This is a problem inherent in #f, not having much to do with whether
it is the empty list as well or not.  Say that you have a program that
will return a particular piece of a structure if it exists or #f if it
does not.  Perhaps the piece of structure is #f itself.  You would
find yourself in the same bind, and we haven't even mentioned lists,
whether empty or not.

The correct (as far as I'm concerned) way to write such programs is to
return (by means of cps, or whatever) two values to the caller.  One
is a success value, the other is the actual value found if the program
succeeded.  There is no ambiguity then, or strange values being passed
around.

    So, *if* it has to remain acceptable that lists may end in #F,
    one should allow them to end in other values as well (just #T
    would do).  Of course, that is no acceptable solution,
    given the state of affairs, so:

The question then would be how to recognize the end of a list?
In other words, what would NULL? do.
Traditionally (null? x) = (eq? x '())
which would be harder to accomodate if many objects terminated lists.