Ah I think I get it. 'x is a symbol pointing to a var which is a box that contains some value (i.e. which could be a function)
i.e. the following def creates a var, puts 1 into it, then creates a symbol 'x and finally adds it to the user namespace : user=> (def x 1) #'user/x we can see it in the namespace : user=> ((ns-map *ns*) 'x) #'user/x user=> ('x (ns-map *ns*)) #'user/x we can resolve the symbol to a var and then get the value in the var : user=> (-> 'x resolve var-get) 1 we can also do this : user=> (-> x var var-get) 1 However, im a bit puzzled by the following code as var is meant to take a symbol and in '(var x)', x is not quoted so since clojure is strict then x it should be evaluated to a Long. Secondly why do I get an error involving Cons? : user=> (type x) java.lang.Long user=> (type (var x)) clojure.lang.Var user=> (var x) #'user/x user=> (type 'x) clojure.lang.Symbol user=> (var 'x) CompilerException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol, compiling:(/tmp/form-init8428687381658026649.clj:1:1) Andy On Friday, 21 March 2014 23:46:33 UTC, John Mastro wrote: > > On Fri, Mar 21, 2014 at 4:44 PM, John Mastro <john.b...@gmail.com<javascript:> > > wrote: >> >> (let [f '(+ 1 1)] >> (apply (resolve (first f) (rest f)))) >> ;=> 2 >> > > Sorry, I have a typo in there. It should be: > > (let [f '(+ 1 1)] > (apply (resolve (first f)) (rest f))) > > -- > John Mastro > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.