Hi folks, new to Clojure...

Question:

How do I rid the following functions of all the '(def STATE num)'
calls? I can not seem to work out a way to use either 'binding', or
'let/atom' that wraps the loop & works as well... Any other comments
are always welcomed. Here's my code:

(defn load-block ([foo]

(def STATE 0)
(def rx (re-pattern (str "(?i)" foo "[[:space:]]*(,|$)")))

  (loop [line (read-line)]
    (when line
      (when (and (not= "" (s/trim line))     ; line not empty
                 (not= "\t" (subs line 0 1))) ; line does not begin w/
a tab
            (if (re-find  rx line)
                (def STATE 1)
                (def STATE 0)))
    (if (= STATE 1)
        (println line))
      (recur (read-line))))))

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