Hi,

Am 24.06.2010 um 07:36 schrieb Tim Robinson:

> Is it possible to define custom atom/data types?
> 
> Example: I would like an atom prefixed with $ to maintain it's own
> type/class.
> 
> i.e.
>> (class $myatom)
> clojure.lang.CustomeName

You can use the old way of "defining" types: by adding a tag to the metadata of 
the atom.

user=> (def a (atom nil :meta {:type ::MyType}))
#'user/a
user=> (type a)
:user/MyType
user=> (def b (atom nil))
#'user/b
user=> (type b)
clojure.lang.Atom

Sincerely
Meikel

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

Reply via email to