Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #13263

Re: Mathematica and Lisp

From Richard Fateman <fateman@cs.berkeley.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Mathematica and Lisp
Date 2013-01-25 06:33 +0000
Message-ID <kdt90k$992$1@smc.vnet.net> (permalink)
References (3 earlier) <kd2ltk$cog$1@smc.vnet.net> <kd7tsg$q3s$1@smc.vnet.net> <kdanpt$3d5$1@smc.vnet.net> <kdlfp1$117$1@smc.vnet.net> <kdnoak$725$1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


On 1/22/2013 8:18 PM, David Bailey wrote:
....
(regarding Lisp)

> Having 3 types of brackets, definitely helps to discern the structure,
> even with indentation.
Some lisp implementations allowed for the use of ]  to terminate all
open parentheses up to the prior [.  It is possible to alter the meaning
of characters in ANSI Common Lisp, so almost anything can be implemented.

  Perhaps LISP could have been improved by
> permitting all three, to be used interchangeably so long as they paired
> correctly.
I expect that this can be done, and maybe already exists. Mathematica
does not allow the nesting of ([{}]) except for special uses, so
building up a big expression as you type is probably about as error 
prone as Lisp, if not quite as unfamiliar.  Note that f(a,g(b),c) has
as many parens as the Lisp  (f a (g b) c)   and that using square 
brackets as f[a,g[b],c] is not much different.  Also note that
the highlighting of the matching left parenthesis is done in 
Mathematica's current front end.  A similar feature is available in Lisp
editors.
>
> Unless the infix front end distinguished reliably between code and data
> (which I don't think it could, in general),

This is generally considered a benefit for advanced programming.  On the
other hand, most programmers spend their time composing programs for 
which it is pretty clear what is a program.   Of the  various types of
data (array, vector, string, hash table, file descriptor, integer, 
float, complex, rational, ..., list ...)  only one could possibly be
a program, namely list.  So it is perhaps not such a big problem as
you might think.

  you would still have a
> problem - ideally you want to see
>
> sin(a)
>
> but
>
> (apples oranges pears)
>
> Also, if you print out an expression, you want the first format, and if
> you print a list, you want the second.

Actually, the notation  (sin a)    instead of  Sin[a] is pretty much of 
a wash.
If you print a fragment of code,
> you may want to see a mixture of both styles. Extra types of brackets
> make all that simple.
Or you may prefer uniformity.  E.g. compare:

Mathematica Input,  Mathematica FullForm    Lisp

a+b+c                   Plus[a,b,c]     (+ a b c)
a^2                     Power[a,2]      (expt a 2)
Sin[x]                  Sin[x]          (sin x)

Also note that Mathematica has abandoned infix for such well known syntax as
the "do" loop.  This would ordinarily look like

for i=1 to 10 by 2 do f(i)....  but is instead Do[f[i],{i,1,10,2}]. 
That's pretty close to (dotimes (f i) i 1 10 2).
Incidentally, common lisp allows
(loop for i from 1 to 10 step 2 do (f i))  or some such thing.
[I don't use it much myself :)





>>
>
>> I rarely write programs of any length in Mathematica, because (as I've
>> said) I hold the programming language in generally low regard.
>> On the other hand I am pretty much familiar with the language because
>> I wrote a parser for it (in Lisp) some time ago, and in my experience
>> one of the best ways to really learn a language is to "implement" it.
>
> Did you implement it, or just parse it?

Certainly not all the application.  Parser + pattern matcher + some 
simple application programs like differentiation, integration. numerical
evaluation done differently; display.  See my web page for free download.
>
> I do agree about learning a language by implementing it. Two of us once
> wrote a Fortran compiler in Fortran (!!), and bootstrapped it. It was
> widely used on Prime computers. One of the things I discovered, was that
> the old issue about Fortran's context sensitive grammar, was an utterly
> trivial problem!

I think there is a standard hack to recognize a "DO" statement by the
fact that there is a comma not enclosed in parentheses. Check for this 
and handle the card differently. There are Fortran compilers written in
Lisp;  in fact most compiler implementations depend upon an intermediate
expression tree language which requires that they include internally
a subset of what some people would recognize as Lisp -- for building
and traversing trees.
>>
>>
>>
>> If I were using a computer to do something that required correct answers
>> for, say, life safety, like building a bridge, I would follow WRI's
>> advice and not use Mathematica.
>> (see http://www.wolframalpha.com/termsofuse/)
>
> So have you found the perfect language - one in which none of the
> functions contain imperfections, and yet which offers anything
> approaching the computational sophistication of Mathematica?

I think that perfection depends on the context. Though they are
not my areas of primary interest, I suspect the Mathematica is pretty
good for some kinds of graphics (though I find it clumsy sometimes,
that is probably my unfamiliarity with the nuances of Graphics objects),
and maybe linear cellular automata.
There seems to be a fairly strong consensus that for numerical
programming there are other competitors favored in engineering schools.

>
> BTW, I wouldn't be surprised if a lot of safety critical code isn't
> written in Fortran!

I expect that is true. It would be a LOT easier to formally prove the
correctness of a FORTRAN program than a Mathematica program.  And there
is even a history of proving FORTRAN compilers correct.  I daresay no
proof that Mathematica is correct is likely to appear any time soon.

RJF

>
> David Bailey
> http://www.dbaileyconsultancy.co.uk
>
>
>
>

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Mathematica and Lisp amzoti <amzoti@gmail.com> - 2013-01-12 03:23 +0000
  Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-01-13 02:51 +0000
    Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-01-14 05:01 +0000
      Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-01-15 04:28 +0000
        Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-01-17 04:15 +0000
          Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-01-18 05:49 +0000
            Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-01-22 07:40 +0000
              Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-01-23 04:18 +0000
                Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-01-24 06:17 +0000
                Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-01-25 06:33 +0000
                Re: Mathematica and Lisp Murray Eisenberg <murray@math.umass.edu> - 2013-01-26 06:37 +0000
                Re: Mathematica and Lisp Murray Eisenberg <murray@math.umass.edu> - 2013-01-26 06:37 +0000
                Re: Mathematica and Lisp "W. Craig Carter" <ccarter@MIT.EDU> - 2013-01-26 21:58 +0000
      Re: Mathematica and Lisp Murray Eisenberg <murray@math.umass.edu> - 2013-01-16 06:39 +0000
        Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-01-17 04:14 +0000
        Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-01-17 04:14 +0000
        Re: Mathematica and Lisp Richard Fateman <fateman@eecs.berkeley.edu> - 2013-01-18 05:50 +0000
        Re: Mathematica and Lisp W Craig Carter <ccarter@MIT.EDU> - 2013-01-18 05:50 +0000
        Re: Mathematica and Lisp Murray Eisenberg <murray@math.umass.edu> - 2013-01-18 05:50 +0000
        Re: Mathematica and Lisp Murray Eisenberg <murray@math.umass.edu> - 2013-01-18 05:49 +0000
        Re: Mathematica and Lisp W Craig Carter <ccarter@MIT.EDU> - 2013-01-18 05:49 +0000
    Re: Mathematica and Lisp John Doty <noqsiaerospace@gmail.com> - 2013-02-01 01:46 +0000
      Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-02 06:15 +0000
        Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-02-03 07:52 +0000
          Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-05 08:06 +0000
            Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-02-06 10:52 +0000
              Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-07 02:28 +0000
      Re: Mathematica and Lisp danl@wolfram.com - 2013-02-02 06:15 +0000
        Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-03 07:51 +0000
      Re: Mathematica and Lisp Andrzej Kozlowski <akozlowski@gmail.com> - 2013-02-03 07:52 +0000
        Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-05 08:06 +0000
          Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-02-06 10:52 +0000
          Palette problem with Feynman slash notation "Dave Snead" <dsnead6@charter.net> - 2013-02-08 10:10 +0000
    Re: Mathematica and Lisp Matthias Bode <lvsaba@hotmail.com> - 2013-02-04 01:19 +0000
    Re: Mathematica and Lisp John Doty <noqsiaerospace@gmail.com> - 2013-02-04 01:20 +0000
      Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-06 06:51 +0000
        Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-02-06 10:52 +0000
        Re: Mathematica and Lisp "mathgroup " <fizzymath@knology.net> - 2013-02-07 02:27 +0000
    Re: Mathematica and Lisp Alex Krasnov <akrasnov@eecs.berkeley.edu> - 2013-02-05 03:23 +0000
    Re: Mathematica and Lisp John Doty <noqsiaerospace@gmail.com> - 2013-02-07 02:28 +0000
      Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-08 10:10 +0000
      Re: Mathematica and Lisp ?iso-8859-1?Q?J=E1nos_L=F6bb?= <janos@lobb.com> - 2013-02-09 05:42 +0000
      Re: Mathematica and Lisp Richard Fateman <fateman@eecs.berkeley.edu> - 2013-02-09 05:43 +0000
    Re: Mathematica and Lisp Andrzej Kozlowski <akozlowski@gmail.com> - 2013-02-08 10:10 +0000
    Re: Mathematica and Lisp John Doty <noqsiaerospace@gmail.com> - 2013-02-08 10:10 +0000
      Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-09 05:43 +0000
      Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-02-10 08:34 +0000
    Re: Mathematica and Lisp Matthias Bode <lvsaba@hotmail.com> - 2013-02-09 05:43 +0000
    Re: Mathematica and Lisp John Doty <noqsiaerospace@gmail.com> - 2013-02-15 06:56 +0000
      Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-02-17 09:08 +0000
        Re: Mathematica and Lisp Joe Gwinn <joegwinn@comcast.net> - 2013-02-18 10:59 +0000
      Re: Mathematica and Lisp "djmpark" <djmpark@comcast.net> - 2013-02-18 11:00 +0000
        Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-22 06:05 +0000
          Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-02-23 12:01 +0000
            Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-24 04:31 +0000
              Re: Mathematica and Lisp David Bailey <dave@removedbailey.co.uk> - 2013-02-25 07:19 +0000
                Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-26 06:09 +0000
  Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-01-13 02:51 +0000
  Re: Mathematica and Lisp John Doty <noqsiaerospace@gmail.com> - 2013-01-16 06:38 +0000
    Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-01-17 04:15 +0000
      Re: Mathematica and Lisp John Doty <noqsiaerospace@gmail.com> - 2013-01-18 05:50 +0000
  Re: Mathematica and Lisp Peter Klamser <klamser@googlemail.com> - 2013-02-24 04:31 +0000
    Re: Mathematica and Lisp Richard Fateman <fateman@cs.berkeley.edu> - 2013-02-25 07:19 +0000
    Re: Mathematica and Lisp John Doty <noqsiaerospace@gmail.com> - 2013-02-26 06:09 +0000

csiph-web