[r6rs-discuss] [Formal] Simplifying conditions

Michael Sperber sperber at informatik.uni-tuebingen.de
Mon Nov 27 01:45:01 EST 2006


AndrevanTonder <andre at het.brown.edu> writes:

> On Sun, 26 Nov 2006, Michael Sperber wrote:
>
>> So how does this suggestion look to you?
>>
>> The condition system distinguishes between simple conditions and
>> compound conditions.  A compound condition consists of an ordered set
>> of simple conditions.  Thus, every condition can be viewed as an
>> ordered set of simple component conditions: If it is simple, the set
>> consists of the condition itself;
>
> - The last sentence may be read to imply that every simple condition is a
>   compound condition.  It is not clear to me if this is true or not.

It's not clear to me either :-) There are no predicates or anything to
distinguish, so it's mainly a matter of presentation.  What's important
is that not every compound condition is a simple condition.  The only
predicate you could define would be:

(define (simple-condition? c)
  (let ((components (condition->list c)))
    (and (pair? components)
         (null? (cdr components)))))

> - Conversely, are singleton compound conditions simple conditions?
>   It seems to me that it would be simplest ;-) if they were indeed simple.
>   For example, does the one-argument case of
>
>     (make-compound-condition simple-condition)
>
>   return a simple condition?

By the above predicate, yes.

> - Also, why not allow the degenerate case of null compound conditions?
>   In other words, is there a deeper reason why the following should be
>   illegal?
>
>    (make-compound-condition)

No, and I don't think it is illegal.

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla



More information about the r6rs-discuss mailing list