It shouldn't.  I can't duplicate what I think you are saying.  Would you be
able to you print the code you entered in the repl that produced these
results?


On Thu, Jun 30, 2011 at 12:02 PM, octopusgrabbus
<octopusgrab...@gmail.com>wrote:

> Thanks you for answering.
>
> I should rephrase the question, and I'll go look at the links you
> posted.
>
> I'm wondering why conj worked in the first of the function that
> operated on the mtr-map defined by def, and not in the version where
> mtr-map was passed in as the first parameter.
>
> On Jun 30, 11:48 am, Mark Rathwell <mark.rathw...@gmail.com> wrote:
> > Clojure data structures are immutable by default (seehttp://
> clojure.org/functional_programming).
> >
> > For mutability, see the following:
> >
> > http://clojure.org/vars
> > <http://clojure.org/vars>http://clojure.org/atoms
> >
> > http://clojure.org/refs
> >
> > http://clojure.org/agents
> >
> > http://clojure.org/transients
> >
> > On Thu, Jun 30, 2011 at 11:35 AM, octopusgrabbus
> > <octopusgrab...@gmail.com>wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Given this empty map,
> >
> > > (def mtr-map {})
> >
> > > this sequence,
> >
> > > (def mtr-seq ["a" 1 "b" 2 "c" 3 "d" 4])
> >
> > > this function,
> >
> > > (defn map-mtr
> > >    [read-map premid reading]
> > >    (conj read-map {premid reading}))
> >
> > > and this call
> >
> > > (map-mtr mtr-map (first mtr-seq) (first (rest mtr-seq)))
> >
> > > mtr-map won't update, but redefining the function to take premid and
> > > reading and allowing the function to operate on the global variable
> > > mtr-map.
> >
> > >  (defn map-mtr
> > >        [premid reading]
> > >        (conj mtr-map {premid reading}))
> >
> > > mtr-map becomes updated.
> >
> > > I'm confused as to how to update mtr-map by allowing it to be passed
> > > into the function in the first example.
> >
> > > --
> > > 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 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 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