Re: What's so great about lisp?
- From: Jon Harrop <usenet@xxxxxxxxxxxxxx>
- Date: Sun, 16 Oct 2005 14:48:40 +0100
Pisin Bootvong wrote:
>>Yes. Lisp forces you to "jump through the hoop" of converting the numbers
>>into some representation that happens to be exact in Lisp. For this
>>example, Mathematica does not require the same hoop jumping because it
>>tracks numerical errors in floating point arithmetic:
>
> My ideal user friendly Lisp in this regard would be Lisp that
> automatically convert floating point literal to rational.
The problem is that rationals have very different properties.
> 1.3 literal can be converted to (/ 13 10).
The representation used by Mathematica tracks numerical error, so it is not
equivalent to 13/10.
> In case one really wants IEEE float, one can always use declaration.
Also, it is not IEEE float.
> There's probably no surprise wrt to the behavior of the program, most
> people would expect rational like behavior than the IEEE bahavior
> anyway.
I think most people would expect mathematical behaviour, which isn't
possible on a computer.
>> (defun fact (n) (if (< n 2) n (* n (fact (1- n)))))
>>...
>>So Lisp "beats" SML and OCaml on that example, but not Mathematica:
>>
>>In[1]:= 120!
>
> What's the point of this example? To show that Mathematica has built-in
> fact function and Lisp don't?
In this case, yes. Mathematica implements a wide variety of functions (e.g.
Gamma) that Lisp does not. So I would not hold up Lisp's numerical tower as
an example of something that makes the language great. It simply puts Lisp
in the middle, between C++ and CASs for example.
> Does Mathematica have built-in condition system like Common Lisp?
It has pattern matching with optionally guarded patterns. I think that
serves the same purpose.
> Should we try to compare number of line of code and effort you have to
> spend to implement that in Mathematica?
Can you give an example of a simple problem and implementation using Lisp's
condition system?
Also, there is also a problem here - Mathematica code is usually typeset, so
it doesn't make sense to compare by LOC. Still, it'll be interesting to
have a look.
> I am sure Mathematica will have trouble beating Common Lisp on that.
I doubt it. :-)
> Line of code in Lisp for condition system will be 0. As is
> Mathematica's Line of code for fact function.
Yep.
> Now would you choose the language that you have implement fact function
> yourself or the language that you have to implement Condition System
> yourself? :-)
That depends upon the application. Right now, Lisp is looking most promising
for writing fast interpreters. Obviously, Mathematica isn't going to
compete there. :-)
--
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com
.
- Follow-Ups:
- Re: What's so great about lisp?
- From: Pisin Bootvong
- Re: What's so great about lisp?
- References:
- Re: What's so great about lisp?
- From: Jon Harrop
- Re: What's so great about lisp?
- From: bradb
- Re: What's so great about lisp?
- From: Jon Harrop
- Re: What's so great about lisp?
- From: Pisin Bootvong
- Re: What's so great about lisp?
- Prev by Date: Re: How best to handle NIL in generics?
- Next by Date: Re: Abbreviated type declaration
- Previous by thread: Re: What's so great about lisp?
- Next by thread: Re: What's so great about lisp?
- Index(es):
Relevant Pages
|