26 Jan 2001 graydon   » (Master)

jdybnis: I think the cheeky answer is to be found in r5rs wrt. the disjointness of types. however, evaluation as boolean is polymorphic, such that anything which is not #f is coerced to #t. so your code can be written as:

(define (breadth . trees)
 (or trees
  (cons (map car trees) 
   (apply breadth 
    (apply append (map cdr trees)))) 

but the perhaps-valid question you could then ask is: why isn't '() coerced to #f, and conversely why there isn't a coerce-to-list form for booleans. dunno. MIT scheme treats them the same, so perhaps they didn't see the logic in it either.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!