You should close the parenthesis all in one line:
(defn binary-search
"Search sorted list for target using binary search technique"
([m_list target]
(if (empty? m_list)
false
(binary-search m_list 0 (- (count m_list) 1) target)))
([m_list m_left m_right target]
(let [gap (- m_right m_left)]
(if (>= 0 gap)
(if (== (nth m_list m_left) target)
(nth m_list m_left)
false)
(let [middle (+ m_left (quot gap 2))]
(if (== (nth m_list middle) target)
(nth m_list middle)
(if (< target (nth m_list middle))
(recur m_list m_left (- middle 1) target)
(recur m_list (+ middle 1) m_right
target))))))))
It safes some space ;)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en