1. Often I use the following construct:

(let [some-var (initial-binding)
      some-var (some operations (assoc, etc.) using some-var pvevious
binding)
      some-var (some operations using some-var pvevious binding
several times)]
  (more operations on some-var))

This is probably something like the `do' monad, and I like the thing
that the usage of previous binding of the variable is possible freely
anywhere in the context without wrapping operations with fn and
calling threading operator.
But things become bad if misspelling occurs. Are there some library
macros for such operations, or possibility to do this in less error-
prone way?

2. Let's assume that there is a map with key :entry, and I need to
assoc new value for this key if it's nil or leave map as is otherwise.
I do this in following way:

...
(let [some-map (if (:entry some-map)
                   some-map
                                   (assoc some-map :entry (get-new-value)))]
...

The question is the same: what is the most correct way to do this?

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