Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: