Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

lisp newbie help

Name: Anonymous 2012-01-01 5:46

if i set the value of a symbol to a function, how do i call it with that symbol?

(setq a #'append)
(a ... ) <--how do i do this?

thanks

Name: Anonymous 2012-01-01 6:03

>>2

ja that only works in the scheme like ones, where functions and variables reside in the same namespace.

Ya gata do it like:

(funcall a ...)

You call a function that takes a variable (which is a function)

You could also do (apply a (...)), which can be more convenient at times.

Some people hate this. Some like variables being in a different name space than functions so you can do:

(defun list (list)
 (if (null? list)
   1
   (list (cdr list))))

I personally perfer being able to call variables that happen to be functions using the same syntax for calling functions.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List