Xah's Edu Corner: The importance of syntax & notations.
rjf
fateman at gmail.com
Sun Aug 16 23:00:42 CEST 2009
On Aug 16, 9:05 am, Peter Keller <psil... at merlin.cs.wisc.edu> wrote:
> In comp.lang.scheme Xah Lee <xah... at gmail.com> wrote:
>
> > Xah's Edu Corner: The importance of syntax & notations.
>
> >http://www.stephenwolfram.com/publications/recent/mathml/mathml_abstr...
>
> > this article should teach the coding sophomorons and computer
> > ?science? idiotic authors who harbor the notion that syntax is not
> > important, picked up by all the elite i-reddit & twittering & hacker
> > news am-hip dunces.
>
> I must have really tweaked you with my "Syntax is not important, ideas are."
> statement.
>
> I read Wolfram's article carefully. He applies an intuitive sense onto
> why he does or doesn't like a particular notation, but yet can't really
> elucidate his feelings. I'm surprised that didn't tweak you worse. He
> also goes so far as to mention that:
>
> "But actually we still don't know a clean simple way to represent things
> like geometrical diagrams in a kind of language-like notation. And
> my guess is that actually of all the math-like stuff out there, only
> a comparatively small fraction can actually be represented well with
> language-like notation."
>
For someone talking about notation and language, it is amusing that
Wolfram refuses to write grammatically correct sentences. Each of the
pseudo-sentences quoted above is a dependent clause. Wolfram writes
like that. He typically begins sentences with "but" or "and".
In the article cited, he also claims to be more-or-less the only
person alive to have thought about these issues, and that Mathematica
is the solution. This is not surprising,and it is nevertheless clear
that Wolfram has spent some time thinking about mathematical notation,
and some money developing fonts and such. His self-praise is perhaps
not deserved.
It is unfortunate that most users of Mathematica labor under a
misunderstanding of the meaning of the fundamental algorithmic
notation of that system, namely "function definition".
f[x_]:=x+1 is not a function definition, although most users think
so.
In fact, it is a pattern/replacement rule.
If you want to write the equivalent of the lisp (defun f(x)(+ x 1))
you can do so in mathematica, but it looks like this:
f=#1+1&
or alternatively,
f=Function[Plus[Slot[1],1]]
or alternatively,
f= Function[{x},x+1]
How do those choices grab you for the Emmy in "Excellence in
Notation"?
By the way, what is wrong with f[x_]:=x+1?
While you might think it maps x->x+1 for all x, it does so only in
the absence of other rules involving f. Thus the presence of another
definition (actually another rule) ... f[z_]:=z^2/;OddQ[z] changes
the definition when the argument is an odd integer.
An equivalent definition is
f[z_?OddQ]:=z^2
now you could have 2 rules
f[x_?Predicate1]:= 123
f[x_?Predicate2]:= 456
and it might not be clear which Predicate is a subset of the other.
(It is clear that the blank pattern "_" is a superset of "_?OddQ" ).
So how does Mathematica deal with this situation?
The predicates are tested in some order until one returns True.
What order is that?
"Whenever the appropriate ordering is not clear, Mathematica stores
rules in the order you give them. "
Oh, when is the ordering not clear?
Uh, "you should realize that this [ordering] is not always possible".
(quotes from mathematica documentation , TheOrderingOfDefinitions.)
While Wolfram has provided an admirable summary of the history of
notation, his solution is less so.
RJF
More information about the Python-list
mailing list