1
0
mirror of https://github.com/janet-lang/janet synced 2025-05-12 12:24:12 +00:00

Adopt docstring from #1574

This commit is contained in:
Calvin Rose 2025-04-03 20:52:40 -05:00
parent 31920e574d
commit 363e32d455

View File

@ -1084,8 +1084,14 @@
(map-aggregator ,maptype ,res (,f x ;call-buffer))))))) (map-aggregator ,maptype ,res (,f x ;call-buffer)))))))
(defn map (defn map
`Map a function over every value in a data structure and ```
return an array of the results.` Map a function `f` over every value in a data structure `ind`
and return an array of results, but only if no `inds` are
provided. Multiple data structures can be handled if each
`inds` is a data structure and `f` is a function of arity
one more than the number of `inds`. The resulting array has
a length that is the shortest of `ind` and each of `inds`.
```
[f ind & inds] [f ind & inds]
(def res @[]) (def res @[])
(map-template :map res f ind inds) (map-template :map res f ind inds)