Re:Can Lisp do What Perl Does Easily?
by Goladus on Friday September 07, 2007 @06:24PM
(#51947)
Defining a function is only the first step. Generally, one defines a function so that it can be called. With perl, you have to use an extra symbol to specify that you're calling a function, where Python infers it if you put a parameter list. Common Lisp lets you do it either way.
Here's a hypothetical Python:
mana=foo(100)
mana(-10)
mana(-15)
Here's Perl:
$mana=foo(100);
&$mana(-10);
&$mana(-15);
Common Lisp:
(setf mana (foo 100))
(funcall mana -10)
(funcall mana -15)
Also Common Lisp:
(setf (symbol-function 'mana) (foo 100))
(mana -10)
(mana -15)
Here's a hypothetical Python:
Here's Perl: Common Lisp: Also Common Lisp: