|
From: | Jon Wilson |
Subject: | Re: (< complex) and friends |
Date: | Thu, 18 Sep 2008 23:07:57 -0400 |
User-agent: | Thunderbird 2.0.0.16 (X11/20080724) |
This definition makes the case (< a b) extend quite naturally to (< a b c ...), as well as to (< a) and (<).
And anyway, what harm does (<) really do? Why do you think that it is "broken"?
Many functions which expect a list (fold, map) or a number of arguments (+, *) accept an empty list or no args as degenerate cases, and give sensible results. When you write a procedure which expects a list or uses a rest arg, you generally handle the degenerate cases gracefully (instead of raising an error). Why should < not be the same?
Bill Schottstaedt wrote:
A couple similar cases:guile> (< 2 1 "hi") #fguile> (* 0 "hi") 0On the (apply < ...) business, I'd rather get an error than have something broken go by just because "it is prettier". That null list is going to trip you...
[Prev in Thread] | Current Thread | [Next in Thread] |