Clojure is form-oriented so you can think of almost all of its
evaluation as sending one form after another to a REPL. In that model
of evaluation, you of course want to be able to re-define a symbol an
arbitrary amount of times.

The serialization of these forms into a file which has other forms in
it is almost incidental. In the case of a file, the forms are passed
one at a time to the interpreter.

There has been some discussion, iirc, of generating a warning when a
symbol is redefined.

On Wed, Aug 27, 2014 at 5:32 AM, Hemant Gautam <gettingerr...@gmail.com> wrote:
> I am new to Clojure, I am currently at Beginner level. While trying to run
> small programs, I found that I can load a file having duplicate code. Let me
> explain it with example.
>
> This is the code
>
> (ns clojure_begins_19_08_2014.core)
>
> (defn first-fn[x]
>   (print x))
>
> (defn first-fn[x]
>   (print "Value of x with String " x))
>
> (first-fn 10)
>
> See, above code consists of two function with same name and with same number
> of arguments.
> When I call first-fn, the function declared later gets called. I get output
> as:
>
> Value of x with String  10
> nil
>
> So can any one explain how this thing is happening and also explain how we
> can have same function written 2 times in a same namespace.
>
> --
> 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/d/optout.

-- 
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/d/optout.

Reply via email to