Welcome! Please see the About page for a little more info on how this works.

0 votes
in Docs by
(doc update-vals)
([m f])
  m f => {k (f v) ...}

  Given a map m and a function f of 1-argument, returns a new map where the keys of m
  are mapped to result of applying f to the corresponding values of m.

Says "...returns a new map where the >>>keys<<< of m are mapped to...". This should be "values," not "keys." Probably a cut/paste holdover from the update-keys doc string.

2 Answers

+1 vote
selected by
Best answer

The doc string is correct. In a map, the keys are mapped to their values. update-vals returns a new map where the keys are mapped to the new values. "Mapped" in those cases means "linked to" and not "being passed to some function".

Ah, I see. Yes. That still seems ambiguous and could be more clear, but yes, I see that it works as written as well.
+1 vote

I think the docstring is correct as written. f is applied to the values of m (as it says). The map returned is a map from the original keys to the new values.