Re: Why is LISP syntax superior?




Thomas A. Russ wrote:
Well, my point is that if you allow mixing of infix and prefix
operators, you have to have some way of knowing which one you
want. Since you seem to like mathematics, what would be the preferred
notation for sin(x) ? In previous posts, you wanted to turn everything
into binary operator form, but I'm at a bit of a loss as to how you do
that with sine.

I already talked about this, as in TeX [::sin x]. The :: is the
corresponding to TeX "\": {\sin x}. Also said as prefix operator was a
special case of a infix parser [{} ::sin x].


Otherwise you give up the ability to treat operators and functions
themselves as first-class values. Higher order functions require that
you be able to pass function objects as arguments. So that means you
will need to introduce an addition syntactic marker, all so that one can
avoid prefix notation.

And your response to the issue of higher order functions is?

Not sure still.

f(x) ==> [::f x]

g(f(x)) ==> [::g [::f x]]

h(x, f(x), g(f(y))) ==> [::h x [::f x] [::g [::f y]]]

Now, the problem is in operators acting on the operator before latter
act in its arguments.

Maybe one possibility could be return to previous version where
operators are explicitly marked. THen operator can be variable or
operator in function of if contains :: or not. That could be similar to
if symbols is head in a LISP list or not.


You missed the point of the question. How is it that you know that
"over" is the operator with arguments a, 2 instead of a being the
operator with arguments over, 2 ?

Yes i can see your point. The point about simple stuff as [a b c d] was
for easyness of input by authors (and i was based in ASCIIMath here
where operators are not marked). In TeX operators are marked with "\"
and in LISP by the head position. In fact, the [a over b] construct is
a copy of TeX {a \over b}

Then i could return to previous version with operators explcitely
tagged

(over a 2) is [a ::over 2]

and

(a over 2) is [::a over 2] or [over ::a 2] or [over 2 ::a] depending of
definition of ::a.

Thanks by this useful correction.

I guess if everything is binary it works, but that still leaves open the
situation where you have unary or ternary or in general n-ary functions
or opeators. Granted, it is theoretically possible to encode n-ary
functions (awkwardly) as sets of binary ones, but it gets very tedious.

This is purely a scientific requirement i am imposing. Of course, any
guy can relax it if find disturbing (it will be implemented in a
special scientific module, not in the core). I can understand it can
sound strange, but please let me follow this way. In nature,

A ==> P

is not fundamental, fundamental process is A + S ==> P + S, however A
==> P is a kind of macroscopic representation or notational
convenience. In mathematics something as sin(x) can be represented as
sequence of binary operations. See the close relationship!

Now turn to ternary processes

A + B + C ==> P

is not fundamental again (in fact nobody has measured a termolecular
process in nature or laboratory). Above is a notational or macroscopic
definition for a sequence of binary processes. Maybe

A + B ==> I

I + C ==> P

Example from mathematics? (2+3+5) is modelled as ((2+3)+5) if one
follow the usual left. In fact formally + is defined binary in
Mathematics and something as 2+3+5 is a notation.

And it also leads to a need to avoid nice abstractions which can be
provided by n-ary relations. For example, what if one wanted to say
that A is BETWEEN X and Y? How would you encode that? In lisp, I
would choose one of
(between a x y) or perhaps (ordered x a y).

It is clear i am not explaining myself. In the approach i am
delineating you can write

(::between a x y) or (::ordered x a y) if you want. Simply ::between
or ::ordered are macro-commands for fundamental binary relationships.
E.g. in Formal mathematics, one can define (x < a < y) as a notation
for binary sequence

(x < a) and (a < y)

This is not very different from relaxing ((2+3)+4) to (2+3+4).

Note that we haven't said anything about whether x > y or x < y, so
reducing the encoding to binary cases will get a lot messier....

But it is as math is defined. There is not a "between" command. You can
work directly with higher level definitions as you can work with LISP
code, but computer (at least mine) works with low-level code

Sorry I do not understand this, what is LISP representation? I do not
know that you mean by under. In layouts, under is lacking argument.

Yes, that is the entire point.

In your scheme you can't interpret this without having to know a priori
which of these is the operator. In lisp, this is clear, because the
operator is always the first element of the list.

Yes, it is a difficulty of the ASCIIMath notation. However if i return
to previous version with operator explicitely marked the head of the
list correspond to "::".

Juan R.

Center for CANONICAL |SCIENCE)

.



Relevant Pages

  • Re: modifying array access syntax
    ... What I had in mind is something that resembles standard notation for the field in question, ... Recall that for beginners in mathematics, the notations typically used in mathematics are by far not obvious. ... So I think the basic tradeoff is as follows: If your interest is to develop the code for your own experiments, it's probably more effective to invest some time into learning the Lisp syntax in order to forget about syntactic issues altogether in the long run. ...
    (comp.lang.lisp)
  • Re: .999... = 1
    ... >>rational can be approached by a sequence of rationals that approach ... >>sequence of values approaching 1. ... > Notation means what the definition _says_ it means, ... >>be put in mathematics, the results would be identical if you used ...
    (sci.logic)
  • Re: why lorentz transformation?
    ... If he didn't think that it was mathematics, ... Deal with the math or shut the fuck up. ... >| new coordinates xi, eta, zeta, tau, and no symbol is used to denote ... notation became important for you later in your posting. ...
    (sci.physics.relativity)
  • Re: Why is LISP syntax superior?
    ... mathematical notation, when it is really related to the own LISP ... have some kind of prefix-based syntax for handling declarations, ... once you have a language defined entirely by this prefix ...
    (comp.lang.lisp)
  • Re: Why is LISP syntax superior?
    ... Firstly, as others have pointed out, Lisp operators are not all binary. ... Using Cambridge prefix notation, the expressions can use the same ... Mathematicians and scientists work with very long expressions without ...
    (comp.lang.lisp)