3 ms·
Functional languages support this type of operation in a few different ways. One is through constructs like Clojure's `take-while`. Instead of setting a vairab
by bkallus 3y ago
Functional languages support this type of operation in a few different ways.
One is through constructs like Clojure's `take-while`. Instead of setting a vairable when you want to exit the loop, you define a predicate that is false when the loop should exit.
Another is through `any` and `all` (aka `some` and `every`), which work in a similar way to `take-while`, except they reduce OR or AND across the returned values from the predicate as they go.
EDIT: grammar and clarity