# Multi-argument array folds, array-for-each in math/array?

**URL:** <https://racket.discourse.group/t/multi-argument-array-folds-array-for-each-in-math-array/3998>\
**Category:** General\
**Tags:** arrays-proposal\
**Created:** [November 7, 2025, 7:26pm UTC](https://racket.discourse.group/t/multi-argument-array-folds-array-for-each-in-math-array/3998 "2025-11-07T19:26:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gambiteer](https://avatars.discourse-cdn.com/v4/letter/g/779978/32.png) [@Gambiteer](https://racket.discourse.group/u/Gambiteer)\
**Post date:** [November 7, 2025, 7:26pm UTC](https://racket.discourse.group/t/multi-argument-array-folds-array-for-each-in-math-array/3998/1 "2025-11-07T19:26:45Z")

</div>

I've scoured the documentation and source code for `math/array` and couldn't find a procedure I would call `array-for-each`, or multi-array argument `array-fold`s. (My motivation is to track down all procedures in `math/array` that broadcast array arguments.)

Am I missing something?

---

<div class="post-metadata">

**Author:** ![soegaard](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/soegaard/32/19_2.png) [@soegaard](https://racket.discourse.group/u/soegaard)\
**Post date:** [November 7, 2025, 10:09pm UTC](https://racket.discourse.group/t/multi-argument-array-folds-array-for-each-in-math-array/3998/2 "2025-11-07T22:09:16Z")

</div>

You can use `for` and `in-array` for `array-for-each`.  
With `for/array` and `in-array` you get an `array-map`.

> **[6.9 Comprehensions and Sequences](https://docs.racket-lang.org/math/array_sequences.html)**

---

<div class="post-metadata">

**Author:** ![Gambiteer](https://avatars.discourse-cdn.com/v4/letter/g/779978/32.png) [@Gambiteer](https://racket.discourse.group/u/Gambiteer)\
**Post date:** [November 7, 2025, 11:01pm UTC](https://racket.discourse.group/t/multi-argument-array-folds-array-for-each-in-math-array/3998/3 "2025-11-07T23:01:55Z")

</div>

Thanks, interesting. I suppose combining `for/fold(r)` and `in-array` gets you `array-fold(r)`.

It appears that `array-ormap` and `array-andmap` are defined separately instead of combining `for/or` and `for/and` with `in-array` to ensure that the implied `array-map` builds a non-strict array. SRFI 231's `array-map` always returns a generalized (non-strict) array, so it appears from `math/array`'s implementation that some aspects of SRFI 231's API can be simplified
