See also https://github.com/cgrand/xforms for a transducer version of
reductions. The argument f must have a nullary arity. (You could probably
create your own variant if you want an explicit init value.) I think something
like this should work:
(require '[net.cgrand.xforms :as x])
(defn xs
;s' it would return you a sequence of
> :
> ```
> [(f s[0]) (f (f s[0]) s[1]) (f (f (f s[0]) s[1]) s[2]) ...]
> ```
>
> or, more concretely, e.g.:
> ```
> util-test> (stateful-map + [0 1 2 3 4 5])
> [0 1 3 6 10 15]
> util-test>
> ```
>
>
uence 's' it would return you a sequence of :
> ```
> [(f s[0]) (f (f s[0]) s[1]) (f (f (f s[0]) s[1]) s[2]) ...]
> ```
>
> or, more concretely, e.g.:
> ```
> util-test> (stateful-map + [0 1 2 3 4 5])
> [0 1 3 6 10 15]
> util-test>
> ```
>
> I
#x27; and 'iterate'...
>
> Given a function 'f' and a sequence 's' it would return you a sequence of
> :
> ```
> [(f s[0]) (f (f s[0]) s[1]) (f (f (f s[0]) s[1]) s[2]) ...]
> ```
>
> or, more concretely, e.g.:
> ```
> util-test> (stateful-m
n you a sequence of :
```
[(f s[0]) (f (f s[0]) s[1]) (f (f (f s[0]) s[1]) s[2]) ...]
```
or, more concretely, e.g.:
```
util-test> (stateful-map + [0 1 2 3 4 5])
[0 1 3 6 10 15]
util-test>
```
I have a couple of approaches to it - one using reduce:
```
(defn stateful-map-1 [f [h &