unison/unison-src/tests/stream/unfold.u

13 lines
223 B
Plaintext

(+) = (Int64.+)
(/) = (Int64./)
(<) = (Int64.<)
Stream.to-sequence
(Stream.take 5
(Stream.unfold
(b ->
if b < +1
then Optional.Some (b + +1, b / +2)
else Optional.None
)
-2))