guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why not support (begin), (cond), (case-lambda), etc?


From: David Kastrup
Subject: Re: Why not support (begin), (cond), (case-lambda), etc?
Date: Fri, 06 Jan 2012 13:26:42 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Alex Shinn <address@hidden> writes:

> On Fri, Jan 6, 2012 at 5:03 PM, Mark H Weaver <address@hidden> wrote:
>
>> Of course, it is not hard to work around these seemingly pointless
>> prohibitions, just as it would not be hard to write
>>
>>  (if (null? xs) 0 (apply + xs))
>>
>> instead of
>>
>>  (apply + xs)
>>
>> but I don't understand why we should have to.  What's the compelling
>> argument on the other side that justifies these annoyances?
>
> This analogy is meaningless, but for the record
> you should be using fold or reduce here.

I don't think it is the task of a language to enforce arbitrary
aesthetic criteria.  He "should be using"?  And one invents arbitrary
syntax rules in order to enforce what he "should be using" rather than
what he could be using if the language worked in a predictable and
logically consistent manner on 0-element cases?

I am perfectly fine with (+) being 0.  That's totally consistent.  I am
not sure whether (-) being an error is a good idea, but since (- 1) is
not even a logical extension backwards from the series ... (- 1 1 1)
(- 1 1), it probably would not make much sense to define the 0-argument
case when the 1-argument case is already an exception.

I was not all too popular with the teachers in school since I tended to
do my proofs from induction starting not with the case of 1-element sums
and products, but rather preferring to start with the 0-element cases
since they tended to be lots simpler.

It boils down to a question of style, and 0-based reasoning tends to be
considered "thinking out of the box" when in reality it is thinking
about a different concept of box.

And I don't think that a computer language should make that hard.  It is
still logical.  If you don't want to go there, that's your own
decision.  But it is cheap to enforce that style on others by
arbitrarily restricting the language.

-- 
David Kastrup




reply via email to

[Prev in Thread] Current Thread [Next in Thread]