-
Notifications
You must be signed in to change notification settings - Fork 32
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
transjuxt
documentation and name unclear
#26
Comments
=> (into [] (x/transjuxt [(map first) (map second)]) [[:a :b] [:a :b] [:a :b]])
[[:a :b]]
; unexpected, let's see which :a and :b we are talking about:
=> (into [] (x/transjuxt [(map first) (map second)]) [[:a :b] [:c :d] [:e :f]])
[[:a :b]]
; ok the first ones (as explained above)
; if we want to get all values for each map we have to collect them with x/into:
=> (into [] (x/transjuxt [(comp (map first) (x/into [])) (comp (map second) (x/into []))]) [[:a :b] [:a :b] [:a :b]])
[[[:a :a :a] [:b :b :b]]]
; ok but we have an extra nesting due to the top-level into [], let's use x/some!
=> (x/some (x/transjuxt [(comp (map first) (x/into [])) (comp (map second) (x/into []))]) [[:a :b] [:a :b] [:a :b]])
[[:a :a :a] [:b :b :b]]
; but in this case it's just simpler to call transjuxt with two arguments (xforms and items source):
=> (x/transjuxt [(comp (map first) (x/into [])) (comp (map second) (x/into []))] [[:a :b] [:a :b] [:a :b]])
[[:a :a :a] [:b :b :b]] Hope this helps |
Note to self: review existing docstring |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I heard the name of transjuxt I assumed it could perform a transformation like so:
Or act as if
juxt
defined a function:but using transjuxt inside the stack like so to avoid multiple traversals:
However, I can't get it to behave this way. I can't tell if I've misunderstood its use and purpose, or if I have called it wrong.
Can you add an example to the documentation of what it's output might look like in practice and how to call it?
The text was updated successfully, but these errors were encountered: