[comp.lang.scheme] Why doesn't r^3rs talk about this?

Dave Mason <dmason@watmsg.waterloo.edu> (04/24/91)

 I am preparing for an introductory CS course this fall where I will
be using scheme (probably Aubrey Jaffer's scm).  Two things came up
(so far :-) that I need which seem very natural to include in a standard
but about which r3rs is silent.

 One of my goals in this course is to get the students to think in
terms of specification, implementation and formal verification of
functions.  I want them to put assertions into their code for pre- and
post-conditions.

So I wanted to write:
	(define (assert predicate message)
		(cond ((not predicate) (error 'assert message))))
but there does not seem to be a standard error function that I can
use.  There is one very much like this in elk, and I've added one to
scm, but a standard seems desirable.

 One of the example solutions which I wanted to explain was merging
two ordered lists.  So I wanted to say something like:
	(define (merge lft rgt)
		(assert (apply <= lft) "merge: arg 1 not ordered")
		(assert (apply <= rgt) "merge: arg 2 not ordered")
		...
	)

I was pleased to see that:
	> (apply <= '(1 2 3 4))
	#t
	> (apply <= '(1 4 2 3))
	#f
 do exactly what I want.  So I used it in my merge function.....and
got errors, which I tracked down to:
	> (apply <= ())

	ERROR: Wrong number of args to #[primitive-procedure <=] from apply.
	> (apply <= '(1))

	ERROR: Wrong number of args to #[primitive-procedure <=] from apply.

where I would claim both of these should return #t.

 r3rs says that the comparison functions should work over list longer
than 2, but says nothing about shorter lists.

Obviously I can write:
	(define (<=? . list)
		(or (null? list) (null? (cdr list)) (apply <= list)))

but it seems like a natural extension to at least discuss (and
preferably require) in r4rs.

Thanks	../Dave