[r6rs-discuss] Comparison procedures' number of arguments
John Cowan
cowan at ccil.org
Tue Oct 28 11:25:09 EDT 2008
Isaac Morland scripsit:
> > (q:call + 1 2 3) is equivalent to (q:call 3 3), which is an error.
I should have said that (q:call + 1 2 3) reduces to (q:call 3 3), which
is in normal form and not further reducible. Irreducible expressions
are not errors in Q.
> What would be the Q S-expression equivalent to (+ 1 (+ 2 (+ 3 4)))?
> That is, the Scheme expression one would have to use instead of your
> example if Scheme + was strictly binary?
It would be the same, namely (q:call + 1 (q:call + 2 (q:call + 3 4)).
In native Q syntax, "1+2+3+4" is syntactic sugar (albeit very useful
sugar) for "(+) 1 ((+) 2 ((+) 3 4))", where (+) is the non-infix and
strictly binary version of +, as in Haskell; the other parens
are for grouping, as in infix languages generally.
> But when numbers are used for their most basic purpose -- counting --
> they must start with 0.
That is, provided you are interested in counting the null set. Basic counting
starts with 1.
--
John Cowan cowan at ccil.org http://ccil.org/~cowan
No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friends or of thine own were: any man's death diminishes me,
because I am involved in mankind, and therefore never send to know for
whom the bell tolls; it tolls for thee. --John Donne
More information about the r6rs-discuss
mailing list