This is the mail archive of the
xconq7@sources.redhat.com
mailing list for the Xconq project.
RFC: Increment and Decrement (was Re: GDL Notice: ArithmeticOperators / Quasi-Formulae)
Hi Juergen,
On Tue, 2004-06-22 at 03:50, Juergen Ruehle wrote:
> Actually I would prefer the (Common) LISP version:
I guess I should have checked to see what Common Lisp did instead of
writing some code first.
> (1+ 5) => 6
> (1- 5) => 6
This seems fairly reasonable. However, GDL has dice specs which look
like mmdnn+oo. Doing something like "1+" looks like part of a dice spec.
This is not a problem from the tokenization point of view; it would
require another tokenizer hack, but that is manageable. I am more
concerned about confusion on the part of GDL users.
> (+ 5) => 5
> (- 5) => -5
I agree. One of the concerns that was in the back of mind was how to
easily negate a number. I think I will change the behavior of unary "+"
and "-" to what you just suggested.
> This avoids overloading of + and -, but that's just IMO.
Thanks for the feedback.
So, I guess the choices for increment and decrement are:
(++ n) (-- n)
(inc n) (dec n)
(1+ n) (1- n)
Does anyone have any preferences (aside from those already stated)?
Regards,
Eric