Erlang Versus Python

Bijan Parsia bparsia@REDACTED
Mon Mar 6 22:18:12 CET 2000


--On Monday, March 06, 2000, 12:02 PM -0500 Vladimir Ulogov
<gandalf@REDACTED> wrote:

> James Hague wrote:
> 
>> requested--that were added to Python--maybe weren't in the best
interests
>> of the language.  Or somesuch.  This is from memory :)
> If we will going back to the Python history, it's never was designed and
> implemented as functional language, unlike Erlang. So, it having
> functions and some as I can say advanced parameters handling, but:
> - no pattern matching;

Actually, a very, very limited sort is available in multiple assignment.

> - nested functions are not too easy

Hmm. I don't see that that's a requirement for functionality.

> - functions are not a data (it possibly to use the functions as a data,
> but it's require some triks)

Actually, it's quite easy to manipulate function (and other code) objects
(this is from the Python repl):

>>> def square(n):
	return n*n

        [Defines a function and binds it to the name 'square'.]
	
>>> square(4)
16

        [applies the function stored in 'square' to 4. You can
"change" square by reassignment.]

>>> square
<function square at 843ce0>
>>> y=square
>>> y
<function square at 843ce0>
>>> y==square
1
>>> y(4)
16
>>> apply(y, (4,))
16

------------

You get the idea. You can also programmatically create function objects
via compile() and friends. So, where're the tricks? ;)

> In Erlang red book, we can read about some ways of the "object oriented"
> approaches for Erlang, but IMHO this is not too serious. It's taff for
> functional language to be a OO at the same time :)

O'cml and friends ;)

RScheme, Common Lisp, Hugs.

Now, whether these are both *good* functional langauges and 00 lauguages
*and* found it easy to be so is a different issue.

Cheers,
Bijan Parsia.





More information about the erlang-questions mailing list