From: Rajesh Kommu
Subject: newbie question regarding sharp-quote
Date: 
Message-ID: <g1f04u$ndn$1@skeeter.ucdavis.edu>
The following works as expected:

(funcall #'+ 1 2 3) ; => 6

but

(funcall '+ 1 2 3)

works too! Don't I always need a sharp-quote to get a function object?

thanks in advance,

rk

From: Ken Tilton
Subject: Re: newbie question regarding sharp-quote
Date: 
Message-ID: <483b0b61$0$11620$607ed4bc@cv.net>
Rajesh Kommu wrote:
> The following works as expected:
> 
> (funcall #'+ 1 2 3) ; => 6
> 
> but
> 
> (funcall '+ 1 2 3)
> 
> works too! Don't I always need a sharp-quote to get a function object?

No, /funcall/ needs a function designator, of which a symbol is one. 
Start at funcall in the CLHS, follow the link to function designator.

kenzo

-- 
http://smuglispweeny.blogspot.com/
http://www.theoryyalgebra.com/
ECLM rant: 
http://video.google.com/videoplay?docid=-1331906677993764413&hl=en
ECLM talk: 
http://video.google.com/videoplay?docid=-9173722505157942928&q=&hl=en
From: George Neuner
Subject: Re: newbie question regarding sharp-quote
Date: 
Message-ID: <kv3m3451crcm47v9qus15kh0092ajhk4pg@4ax.com>
On Mon, 26 May 2008 11:39:29 -0700, Rajesh Kommu
<······@student.physics.ucdavis.edu> wrote:

>The following works as expected:
>
>(funcall #'+ 1 2 3) ; => 6
>
>but
>
>(funcall '+ 1 2 3)
>
>works too! Don't I always need a sharp-quote to get a function object?
>
>thanks in advance,
>
>rk

You need the #' (or equivalent) in situations where the symbol would
normally be evaluated as data.  funcall is an exception because it
evaluates its first argument as a function.

George
--
for email reply remove "/" from address
From: Kent M Pitman
Subject: Re: newbie question regarding sharp-quote
Date: 
Message-ID: <uzlqcwym9.fsf@nhplace.com>
Rajesh Kommu <······@student.physics.ucdavis.edu> writes:

> The following works as expected:
> 
> (funcall #'+ 1 2 3) ; => 6
> 
> but
> 
> (funcall '+ 1 2 3)
> 
> works too! Don't I always need a sharp-quote to get a function object?

Funcall of '+ means (funcall (symbol-function '+) ...), which does not
access the lexical environment, only the global environment;
while using #'+ means (funcall (function +) ...), where the function
special form which accesses the lexical environment.
Since you are prohibited from lexically binding +, it is unlikely you will
see a difference, since you will always be in an environment that has no
lexical bindings for + as a function.  But if you were to use
'foo vs #'foo it would affect things.

 (defun foo (x) x)
 (flet ((foo (x) (1+ x)))
   (list (funcall 'foo 1) (funcall #'foo 1)))
 => (1 2)
From: Giovanni Gigante
Subject: Re: newbie question regarding sharp-quote
Date: 
Message-ID: <483b0cc7$0$35960$4fafbaef@reader2.news.tin.it>
Rajesh Kommu wrote:
> The following works as expected:
> 
> (funcall #'+ 1 2 3) ; => 6
> 
> but
> 
> (funcall '+ 1 2 3)
> 
> works too! Don't I always need a sharp-quote to get a function object?
> 
> thanks in advance,
> 
> rk


According to the Hyperspec,
 > *funcall* applies /function/ to /args/. If /function/ is a symbol, it 
is coerced to a function as if by finding its functional value in the 
global environment.

So (funcall '+ 1 2 3) is coerced to (funcall #'+ 1 2 3).