"msapp...@web.de" <damnedmar...@web.de> writes:

> (defn initialize-game [container]
> do(
(Log/info "INIT FN START")
[...]
> )
> )

> Why does it throw the exception?

The 'do' should be inside the parens, not before them.  Your indentation
also appears to be messed up which makes it harder to spot the problem.

The reason you get a NullPointerException is Log/info returns nil/null,
so you're effectively doing this:

(nil ...)

Calling nil causes a NullPointerException.

> 2. Question:
> I read this in on clojure.org:
>
> I have to initialize a tiled-map (special map created with the
> tiled.org mapeditor) once.
> So I want to create a var.  (If question 1 is resolved and I can use
> initialize ... )
>
> Should I use refs or is it okay to use (def ...) in initialize?
>
> Because the values specified in "initialize-game" should not be
> mutable!

If it's truly immutable -- you never want to change or reload maps while
game is running and initialize-game only ever gets called once, I'd
personally probably say that's okay.

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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to