On Fri, Oct 07, 2011 at 08:53:20AM +0100, Mark Carter wrote:
> I would like to treat a symbol as a function, and apply it to some arguments. 
> In other words, if I did something like
> (define sym '+)
> (apply '+ '(1 2))
> I would obtain the answer 3. Is there any way I can do this? The following 
> works, but I'm wondering if it's the best way:
> (eval `(apply ,sym '(1 2)))
> A more basic question would be: is there any way I can convert from '+ to + - 
> i.e. a symbol to a function?

Looking at the replies so far leaves me wondering why no one has 
yet suggested

(apply + '(1 2))

Is there some subtlety I'm missing?

-- hendrik
_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/users

Reply via email to