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

Sets get converted to lists, should they? #8

Open
PEZ opened this issue Oct 9, 2022 · 0 comments
Open

Sets get converted to lists, should they? #8

PEZ opened this issue Oct 9, 2022 · 0 comments

Comments

@PEZ
Copy link

PEZ commented Oct 9, 2022

I don't know if this is a bug or just out of scope of the library:

(supdate #{} [identity]) => ()

I was expecting:

(supdate #{} [identity]) => #{}

I noticed it when reading this medley PR description: weavejester/medley#63

I tried to solve the example with supdate (mostly to learn how supdate works), and found myself having to restore the set type the orders collection:

(def m {:users [{:id 1 :orders #{{:items [{:price 1} {:price 4} {:price 2}]}}}
                {:id 2 :orders #{}}]}) 
(-> m 
    (supdate {:users [{:orders [{:items [{:price #(str "$" %)}]}]}]})
    (supdate {:users [{:orders set}]}))
=>
{:users [{:id 1 :orders #{{:items [{:price "$1"} {:price "$4"} {:price "$2"}]}}}
         {:id 2 :orders #{}}]}
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