Questions tagged [fold]

Reducing a sequence of terms to a single term.

Filter by
Sorted by
Tagged with
5
votes
1answer
88 views

fold expressions using a function recursively

I have written an accumulate function similar to std::accumulate that works on a std::array. The goal is to remove the loop using fold expressions. This code currently works in c++17: ...
1
vote
1answer
199 views

Implementations of unzip in Racket

I've been practicing my folds and tail-call recursive programming, and I wanted to work on unzip for the general case as opposed to just pairs. This was very easy ...