Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between procedure and #'procedure in Lisp/Clojure?

Tags:

clojure

lisp

What is the difference between the evaluation of double and #'double in Clojure/Lisp?

1:2 user=> double
#<core$double__4077 clojure.core$double__4077@1acd47>
1:3 user=> #'double
#'clojure.core/double
like image 987
unj2 Avatar asked Jul 22 '09 03:07

unj2


1 Answers

In Clojure, #'foo is a shorthand for (var foo), which returns the variable object foo refers to, as opposed to its value. Look it up in the reference:

  • Macro Characters
  • var.

I am not sure if you also want to know the meaning in Lisp: In Common Lisp, #'foo is a shorthand for (function foo), which is used to access the function value bound to the name foo when not in operator position.

  • Sharpsign Single-Quote
  • function.
like image 84
Svante Avatar answered Nov 15 '22 09:11

Svante