I'm a little confused over when to use a var vs. a ref vs. an agent
vs. an atom. For writing small (<200 lines) single-threaded programs
when do I want to use each one?

Also, since you can use def to change a binding how do I know for sure
that some function is not generating side-effects? I mean if it's my
code I can be somewhat confident about what it's doing, but if it is a
blackbox function how can I trust it? A very crude example would be
something like:
(defn square [n]
        (def x n)
        (def n 6)
        (* x x))

I've ran that in the repl and it doesn't change the values of what is
passed to it, but is the same true for multithreaded apps? What if
between (def n 6) and (* x x)) a different thread requested the value
of n? Basically, I want to know when is immutability guaranteed?

What is a form? In this overview of clojure, it talks about bindings
and forms. The fragment that I am trying to understand is "The let
special form creates bindings that are local to that form".
http://java.ociweb.com/mark/clojure/article.html#Bindings

Thanks in advance.

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