Hi,

Am 13.06.2011 um 22:04 schrieb Razvan Rotaru:

> (defn authenticate? [uri name pass]
>         (loop [user-pass (partition 2 (.getStringArray *conf*
> "authentication"))]
>               (if user-pass
>                         (if (re-matches (re-pattern (ffirst user-pass)) uri )
>                                 true
>                                 (recur (rest user-pass)))
>                         false)
>                ))

(defn authenticate?
  [uri name pass]
  (loop [user-pass (seq (partition 2 (.getStringArray *conf* 
"authentication")))]
    (if user-pass
      (if (re-matches (re-pattern (ffirst user-pass)) uri)
        true
        (recur (next user-pass)))
      false)))

You probably want something more like this. Note the tactically placed seq and 
the use of next instead of rest. Does that solve your problem? (I suspect, that 
you get a nil from the ffirst. rest doesn't give you a nil (next does), so your 
loop doesn't stop correctly. But I haven't tested this.)

Sincerely
Meikel

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

Reply via email to