sublists: Extracting subset of lazy stream

Description Usage Arguments Examples

Description

the order of parameters is different from Haskell. The first argument is a lazy steram which enable you to use magrittr's pipe smoothly.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
ltake(x, n)

ldrop(x, n)

lsplitAt(x, n)

ltakeWhile(x, f)

ldropWhile(x, f)

lspan(x, f)

lbreak(x, f)

Arguments

x

a lazy stream

n

intege

f

predicate function (a' -> Boolean)

Examples

1
2
3
4
5
6
7
8
x <- 1 %..% 10
ltake(x, 5) # => llist(1, 2, 3, 4, 5)
ldrop(x, 7) # => llist(8, 9, 10)
lsplitAt(x, 4) # => list(1%..%3, 4%..%10)
ltakeWhile(x, function(x) x < 4) # => 1%..%3
ldropWhile(x, function(x) x < 4) # => 4%..%10
lspan(x, function(x) x < 4) # => list(1%..%3, 4%..%10)
lbreak(x, function(x) x >= 4) # => list(1%..%3, 4%..%10)

TobCap/lazystreamr documentation built on May 9, 2019, 4:50 p.m.