Hi all,
I'm new to Java, Lisp and Clojure, so please be patient. I'm trying to make
a function that behaves as follows: (my-deref x) returns x if x is a var, or
@x if x is a ref. However none of the obvious options seem to be working.


- First, it seems from the api documentation that @x will work fine even if
x is a var. I don't understand the following:

user=> (def x 5)
#'user/x
user=> @x
java.lang.IncompatibleClassChangeError (NO_SOURCE_FILE:0)
user=> (var? x)
false

or

user=> (def x)
#'user/x
user=> (var? x)
false

Why isn't x a var?


- Second, I remember having seen a ref? function analogous to var? in the
online documentation, but it doesn't seem to actualy exist:

user=> (ref? x)
java.lang.Exception: Unable to resolve symbol: ref? in this context
(NO_SOURCE_FILE:13)


Thanks in advance,
Anand

--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to