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

Make MAP-VALS work on records #303

Open
arichiardi opened this issue Mar 2, 2021 · 0 comments
Open

Make MAP-VALS work on records #303

arichiardi opened this issue Mar 2, 2021 · 0 comments

Comments

@arichiardi
Copy link

As per Slack discussion, here is the repro showing that MAP-VALS throws an UnsupportedOperationException on records.

user=> (require '[com.rpl.specter :as specter])
nil
user=> (defrecord Foo [a b])
user.Foo
user=> (def m (map->Foo {:a 1 :b 2}))    
#'user/m
user=> (specter/transform [specter/MAP-VALS] inc m)
Execution error (UnsupportedOperationException) at user.Foo/empty (REPL:1).
Can't create empty: user.Foo

The workaround that I am using at the moment is to (into {} m) before passing it to specter - fortunately this only happens in logging and it is not critical performance-wise.

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