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

content.adoc Composition example gets "nth not supported on this type: Long" error #9

Open
wrightmikea opened this issue Jul 20, 2017 · 0 comments

Comments

@wrightmikea
Copy link

When I evaluate the composition example (using cider nrepl) I get an "nth not supported on this type: Long" error.

user> (require '[lentes.core :as l])
nil
user> (def my-lens (comp l/fst l/fst (l/nth 2)))
#'user/my-lens
user> (def data
[[0 1 2]
[3 4 5]])
#'user/data
user> (l/focus my-lens data)
UnsupportedOperationException nth not supported on this type: Long clojure.lang.RT.nthFrom (RT.java:888)
user>

Either my-lens should have one fewer l/fst function in the composed function or the data needs another level of square brackets, right?

This works for me:

user> (def my-lens2 (comp l/fst (l/nth 2)))
#'user/my-lens2
user> (l/focus my-lens2 data)
2
user> (def data2
[[[0 1 2]
[3 4 5]]])
#'user/data2
user> (l/focus my-lens data2)
2
user>

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

No branches or pull requests

1 participant