For Programmers: Free Programming Magazines  


Home > Archive > Functional > May 2007 > Re: Why stay with lisp when there are python and perl?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Why stay with lisp when there are python and perl?
Xah Lee

2007-05-04, 4:10 am

Dear Dr Jon D Harrop,

Thanks for the explanation and various info about graphics programing
in the past threads.

Xah

---------------------------------------
Nameless wrote:
=ABWhy should I keep on learning lisp when there are python and perl?=BB

Jon Harrop
=AB
Lisp compilers are much more advanced, for one thing.

..=2E.
http://blade.nagaokaut.ac.jp/cgi-bi...uby-talk/239715

Also, here is a symbolic derivative example:

http://codecodex.com/wiki/index.php?title=3DDerivative

Note that pattern matching (as found in OCaml, F#, Haskell etc.) is
very
useful for this kind of term rewriting and is not found in Python,
Perl or
Lisp.

In Standard ML, Haskell and F# you must define a sum type that
represents a
symbolic expression whereas, in Lisp, you can use the built-in
s-expressions. The sum type that you define typically includes a
"Symbol"
that carries its string name. For example, the F# code cited above
used:

type expr =3D
| Int of int
| Add of expr * expr
| Mul of expr * expr
| Var of string with
static member ( + ) (f, g) =3D Add(f, g)
static member ( * ) (f, g) =3D Mul(f, g)
end

in this case, "Var" represents a symbol, e.g. the value Var "x" would
represent a variable x.

However, note that the best Lisp implementation of the symbolic
simplifier
(by Pascal Constanza) avoids s-expressions, improving performance.

In OCaml, you can rely on the compiler inferring the sum type for you
by
using polymorphic variants. However, this is not generally a good idea
because they are slower and harbor some of the divantages of
dynamic
typing.

It is worth noting that eager, statically-typed languages like OCaml
and F#
are many times faster than the other languages at this task. This is
precisely the forte of OCaml and F#, manipulating trees and graphs.
=BB

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com