help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: if vs. when vs. and: style question


From: Rusi
Subject: Re: if vs. when vs. and: style question
Date: Wed, 25 Mar 2015 07:02:41 -0700 (PDT)
User-agent: G2/1.0

On Wednesday, March 25, 2015 at 12:49:59 PM UTC+5:30, Pascal J. Bourguignon 
wrote:
> Rusi writes:
> 
> > On Wednesday, March 25, 2015 at 8:10:18 AM UTC+5:30, Emanuel Berg wrote:
> >> "Pascal J. Bourguignon"  writes:
> >> 
> >> > But then, why stop with +?
> >> >
> >> > You could use instead:
> >> >
> >> >    (funcall (additive-operator (ring integer))
> >> > (neutral-element (multiplicative-operator (ring
> >> > integer))) 5) ; 6
> >> >
> >> > or something even more general?
> >
> > I find Pascal's example brilliant and hilarious.
> > In this case though, I slightly err on your (Emanuel) side.
> >
> > When I see the 1+, I have a stop (like um... er...)
> > Is that a number, an expression, a constant, a comment?
> >
> > Oh Oh.. Functions can start with digits (Yeah this is lisp...)
> 
> 
> Indeed, it is clear that the names 1+ and 1- are ill-choosen.
> Notably 1-!!!
> 
>             (1- x) == (- x 1)
> 
> 
> BUT
> 
> Those are actually fundamental operators, more fundamental than addition
> and substration, both in a theoric way, and in practice with a lot of
> processors.
> 
> They are the operators named succ(x) and pred(x) in pascal (which C
> lacks as independent operators, but have combined with updating with the
> pre- and post- complifications of ++x, x++, --x, and x--; C is THE crazy
> language).
> 
> 
> In axiomatic number/set theory, we only assume a number noted 0, and a
> succ(x) operation that let us build a new number from any number x.
> 
> so 1 = succ(0) by definition.  (= 1 (1+ 0))
> 
> You do not program it the other way around, defining 1+ from x and 1,
> you define 1 from 1+ and 0!
> 
> And the proof, is that processors usually have an increment and a
> decrement operation even while they may lack a general load operation
> (working or any immediate word-sized number).
> 
> So when you write x:=512; you may actually obtain a "load #511; incr"
> instruction sequence, ie. (1+ 511).
> 
> 
> 
> So write: 
> 
>    (defun succ (x) (1+ x)) 
>    (defun pred (x) (1- x)) 
> 
> or in elisp:
> 
>    (defalias 'succ '1+)
>    (defalias 'pred '1-)
> 
> and use (succ x) instead of (1+ x) or (+ x 1).
> 
> 
> (Remember that the only literal numbers allowed in a program source are
> 0 and 1; well, it's even better if you allow only 0 and (succ x)).


You are in a funny mood today Pascal!!

Yeah I know that math pre-exists the universe...
And arithmetic is core math
And Peano's axioms are the heart of arithmetic
Yeah Yeah I know I know...

Still choosing identifiers in a programming language (even Lisp!)
to align with Peano's axioms seems a bit much... Dont you think?

On a different note...
For 50 years CS has been living in the impoverished world of ASCII.
This makes people think CS and math are more far apart than they 
essentially/really are.

I wrote this as my wish for python:
http://blog.languager.org/2014/04/unicoded-python.html
Isn't it about time lisp also considered a similar line?


reply via email to

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