Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect leftmost behavior #15

Closed
weavejester opened this issue Nov 22, 2014 · 3 comments
Closed

Incorrect leftmost behavior #15

weavejester opened this issue Nov 22, 2014 · 3 comments
Assignees

Comments

@weavejester
Copy link

The rewrite-clj.zip/leftmost function doesn't appear to work correctly. This may be a bug in fastzip, or in the way rewrite-clj constructs the zipper.

user=> (-> (z/of-string "(merge foo bar)") z/down z/leftmost z/node)
[:token merge]
user=> (-> (z/of-string "(merge foo bar)") z/down z/right z/leftmost z/node)
[:token foo]

These two expressions should return the same value. I've tested this with rewrite-clj 0.3.10, and I've tried updating fastzip to 0.5.1 without success.

@xsc
Copy link
Contributor

xsc commented Nov 22, 2014

Looks like a bug in fast-zip (tried it with 0.5.1):

(require '[fast-zip.core :as z])
(let [loc (z/seq-zip '(a b c d e f))]
  (->> (z/down loc)
       (iterate z/right)
       (take-while identity)
       (map (comp z/node z/leftmost))))
;; => (a a b c d e)

xsc pushed a commit that referenced this issue Nov 22, 2014
@xsc xsc added the upstream label Nov 22, 2014
@xsc xsc self-assigned this Nov 22, 2014
@xsc xsc added the bug label Nov 22, 2014
@xsc xsc closed this as completed in b85d3e9 Nov 23, 2014
@xsc
Copy link
Contributor

xsc commented Nov 23, 2014

Released.

[rewrite-clj "0.3.11"]

@weavejester
Copy link
Author

Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants