Re: Recursive function that does not terminate!

2009-06-24 Thread Cosmin Stejerean
On Wed, Jun 24, 2009 at 6:42 AM, Rich Hickey wrote: > > On Tue, Jun 23, 2009 at 8:02 PM, Stephen C. Gilardi > wrote: > > > > On Jun 23, 2009, at 6:22 PM, pupsik wrote: > > > >> The following recursive function does not > >> terminate if I exexute it in my REPL. > >> What is wrong? > >> (This exam

Re: Recursive function that does not terminate!

2009-06-24 Thread Rich Hickey
On Tue, Jun 23, 2009 at 8:02 PM, Stephen C. Gilardi wrote: > > On Jun 23, 2009, at 6:22 PM, pupsik wrote: > >> The following recursive function does not >> terminate if I exexute it in my REPL. >> What is wrong? >> (This example is from the official Clojure-website). >> >> (defn my-zipmap [keys va

Re: Recursive function that does not terminate!

2009-06-23 Thread Stephen C. Gilardi
On Jun 23, 2009, at 6:22 PM, pupsik wrote: The following recursive function does not terminate if I exexute it in my REPL. What is wrong? (This example is from the official Clojure-website). (defn my-zipmap [keys vals] (loop [my-map {} my-keys (seq keys) my-vals (seq vals)]

Re: Recursive function that does not terminate!

2009-06-23 Thread Cosmin Stejerean
On Tue, Jun 23, 2009 at 5:22 PM, pupsik wrote: > (defn my-zipmap [keys vals] > (loop [my-map {} > my-keys (seq keys) > my-vals (seq vals)] >(if (and my-keys my-vals) > (recur (assoc my-map (first my-keys) (first my-vals)) > (rest my-keys) > (rest

Recursive function that does not terminate!

2009-06-23 Thread pupsik
When I execute the following code snippet in the REPL I get an infinite loop. (The example is from the official Clojure-website, topic 'Functional Programming') What is wrong? (defn my-zipmap [keys vals] (loop [my-map {} my-keys (seq keys) my-vals (seq vals)] (if (and my-

Recursive function that does not terminate!

2009-06-23 Thread pupsik
The following recursive function does not terminate if I exexute it in my REPL. What is wrong? (This example is from the official Clojure-website). (defn my-zipmap [keys vals] (loop [my-map {} my-keys (seq keys) my-vals (seq vals)] (if (and my-keys my-vals) (recur (a