Re: 1st script, last hurtle...

2011-02-17 Thread mss
Armando, James,  Mike.

Thank you very much for the help, I'll certainly put your ideas to
good use.

Appreciate it!

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


1st script, last hurtle...

2011-02-16 Thread mss
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