Calling a returned function.
Posted: Mon Feb 08, 2010 9:03 am
The details of why I'm trying to do this are somewhat complicated, and I know how I can workaround the problem, but why can't I make an inline call to a function returned from another function? I can't find any punctuation things (' #' @, , `) that can help. Here's a test case...
(BTW, if there's a name for the syntactic sugar that's not really punctuation, I would appreciate it.)
(BTW, if there's a name for the syntactic sugar that's not really punctuation, I would appreciate it.)
Code: Select all
CL-USER> (defun foo () #'bar)
FOO
CL-USER> (defun bar () (* 70 7))
BAR
CL-USER> (foo)
#<FUNCTION BAR NIL (DECLARE (SYSTEM::IN-DEFUN BAR)) (BLOCK BAR (* 70 7))>
CL-USER> ((foo))
EVAL: #1=(FOO) is not a function name; try using a symbol instead
[Condition of type SYSTEM::SIMPLE-SOURCE-PROGRAM-ERROR]
; Evaluation aborted.
CL-USER> (setf (fdefinition `???) (foo))
#<FUNCTION BAR NIL (DECLARE (SYSTEM::IN-DEFUN BAR)) (BLOCK BAR (* 70 7))>
CL-USER> (???)
490