Hey, congratulations on finding and fixing the problem!

And thanks for the great link to the zipper explanation....zippers
were
at the top of my list to learn (seriously). Did you catch this other
useful
link (in the comments of the article you provided)?

http://okmij.org/ftp/Computation/Continuations.html#zipper

This guy has a wealth of great information and references
to related topics.
    regards,
    -tom


On Jan 18, 7:31 pm, Nicolas Buduroi <nbudu...@gmail.com> wrote:
> I've now changed my test method to this.
>
> (def pit (iterate list "bottom!"))
>
> (defn get-bottom [p]
>   (loop [p (first p)]
>     (if (seq? p) (recur (first p)) p)))
>
> (defn test-walk [walker shallowest deepest]
>   (doseq [depth (range shallowest deepest)]
>     (println (get-bottom
>                (walker #(str depth " reached " %)
>                  (lazy-seq (last (take depth pit))))))))
>
> And now everything make lot more sense. A classic case of good code
> with bad test which make you search for some imaginary bug. So always
> carefully read your stack traces! Here's some benchmarking I've done
> with the above versions.
>
> user> (time (test-walk lazy-recursive-string-walk-with-zipper 100000
> 100001))
> 100000 reached bottom!
> "Elapsed time: 1368.337794 msecs"
>
> user> (time (test-walk lazy-recursive-string-walk 100000 100001))
> 100000 reached bottom!
> "Elapsed time: 233.80888 msecs"
>
> user> (time (test-walk really-lazy-recursive-string-walk 100000
> 100001))
> 100000 reached bottom!
> "Elapsed time: 223.631872 msecs"
>
> The one with a zipper is the slowest, zippers being much more capable
> than just walking data structure, so it's normal. The first lazy
> version is more than five faster and the one using Tom Hicks lazy-walk
> function is slightly faster.
>
> - budu
-- 
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