unfoldr package:vector

O(n) Construct a vector by repeatedly applying the generator function to a seed. The generator function yields Just the next element and the new seed or Nothing if there are no more elements.
unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10
= <10,9,8,7,6,5,4,3,2,1>
Unfold
Unfold
O(n) Construct a vector by repeatedly applying the generator function to a seed. The generator function yields Just the next element and the new seed or Nothing if there are no more elements.
unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10
= <10,9,8,7,6,5,4,3,2,1>
O(n) Construct a vector by repeatedly applying the generator function to a seed. The generator function yields Just the next element and the new seed or Nothing if there are no more elements.
unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10
= <10,9,8,7,6,5,4,3,2,1>
O(n) Construct a vector by repeatedly applying the generator function to a seed. The generator function yields Just the next element and the new seed or Nothing if there are no more elements.
unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10
= <10,9,8,7,6,5,4,3,2,1>
O(n) Construct a vector by repeatedly applying the generator function to a seed. The generator function yields Just the next element and the new seed or Nothing if there are no more elements.
unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10
= <10,9,8,7,6,5,4,3,2,1>
O(n) Construct a vector with exactly n elements by repeatedly applying the generator function to a seed. The generator function yields the next element and the new seed.
unfoldrExactN 3 (\n -> (n,n-1)) 10 = <10,9,8>
O(n) Construct a vector with exactly n elements by repeatedly applying the monadic generator function to a seed. The generator function yields the next element and the new seed.
O(n) Construct a vector by repeatedly applying the monadic generator function to a seed. The generator function yields Just the next element and the new seed or Nothing if there are no more elements.
O(n) Construct a vector with at most n elements by repeatedly applying the generator function to a seed. The generator function yields Just the next element and the new seed or Nothing if there are no more elements.
unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>
O(n) Construct a vector by repeatedly applying the monadic generator function to a seed. The generator function yields Just the next element and the new seed or Nothing if there are no more elements.
Unfold exactly n elements
Unfold at most n elements
Unfold exactly n elements
Unfold exactly n elements with a monadic function.
Unfold with a monadic function
Unfold at most n elements
Unfold at most n elements with a monadic function.