On Thu, Oct 31, 2013 at 9:15 AM, Mars0i <marsh...@logical.net> wrote:

> Excellent.  Thanks Tassilo.  I had attempted to do the same sort of thing
> using
>     Point.
> rather than
>     ->Point
> which didn't work:
>     user => (doc Point.)
>     nil
>     user=> Point.
>     CompilerException java.lang.ClassNotFoundException: Point.,
> compiling:(NO_SOURCE_PATH:0:0)
>     user=> ->Point
>     #<user$eval254$__GT_Point__269 user$eval254$__GT_Point__269@3c90fa05>
>
> I had assumed that Point. and ->Point were the same thing, but they are
> apparently not.  ->Point names something real, while Point. is just some
> kind of magic, I guess.
>

The thing to remember here is that by defining a record you are creating a
new Java class. As a convenience a factory function (Point->) is created
for you, but you can always create instances of your record via the
constructor (Point.). Point. is a macro that expands to (new Point).

Take a look at http://clojure.org/datatypes for an introduction of what is
going on when you use defrecord and
http://clojure.org/java_interop#Java%20Interop-The%20Dot%20special%20form-(new%20Classname%20args*)for
the constructor documentation.

Mauricio

-- 
-- 
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/groups/opt_out.

Reply via email to