What am I missing here? I was playing with apply in Scheme, and wrote:
(apply apply '(+ (1 2 3)))
The way I understand it, the first apply should do:
(apply + '(1 2 3))
and the second should do:
(+ 1 2 3)
But both Ypsilon and Gauche give about the same error (this is Ypsilon’s):
error: attempt call non-procedure: (+ 1 2 3)
backtrace:
0 (apply apply '(+ (1 2 3)))
..."/dev/stdin" line 1
What have I failed to understand?
The problem with
'(+ (1 2 3))is that the+is quoted and thus interpreted as a symbol.You would have to use
evalto get a value for the+symbol.In other words, what you are trying to do, is not going to work.
Edit: Another option is quasiquote. Eg:
Or (without quasiquote)