bug-make
[Top][All Lists]
Advanced

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

Re: math expressions (was: Re: Tail call elimination)


From: Paul Smith
Subject: Re: math expressions (was: Re: Tail call elimination)
Date: Thu, 28 May 2020 16:19:15 -0400

On Thu, 2020-05-28 at 22:07 +0200, Jouke Witteveen wrote:
> Here is a thought: The current support for numeric variables is
> limited to unsigned numbers. We could choose to stick with that!

I'm not sure how this would work... it works today because we have no
subtraction and all numbers make can generate are always positive, but
if you allow subtraction then you have to decide what to do with
negative numbers.  I guess we could throw a fatal error.

Seems pretty harsh! :)

> Note that when LIST is empty, addition and subtraction should yield
> "0", while multiplication and division should yield "1".

I think this needs to be defined but there are two ways to do it.  And
in addition to the empty list, you need to decide what to do about a
unary list (list with only one value).

In one of my earliest messages on this list I suggested as you do here,
that we use the identity function for the operator.  This boils down to
saying that the initial value of the accumulator for the math function
is 0 for addition/subtraction and 1 for multiplication/division.

Then I had another thought, that always using 0 might be useful in some
situations... but I was thinking specifically of multiplication:
obviously that won't work for division.

So, I think the identity function is the right choice.




reply via email to

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