On Ubuntu, if I run MIT-Scheme, it will show a function as a procedure:
1 ]=> (define (sq x) (* x x))
;Value: sq
1 ]=> (sq 3)
;Value: 9
1 ]=> sq
;Value 11: #[compound-procedure 11 sq]
and Berkeley's STk will show sq
as a closure:
STk> (define (sq x) (* x x))
sq
STk> (sq 3)
9
STk> sq
#[closure arglist=(x) b73fab48]
How come in Lisp (Common Lisp clisp), when I do the same thing, it will give me an error instead, and how can I show a function as a value (first class value / object)?
[1]> (defun sq(x) (* x x))
SQ
[2]> (sq 3)
9
[3]> sq
*** - SYSTEM::READ-EVAL-PRINT: variable SQ has no value
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead of SQ.
STORE-VALUE :R2 Input a new value for SQ.
ABORT :R3 Abort main loop
Common Lisp, unlike Scheme, keeps separate namespaces for variables and function names. Try #'sq
in CL. Also google around for 'Lisp1 vs Lisp2' for endless verbiage on the subject.