generators: Lazy stream generators

Description Usage Arguments Examples

Description

generate a lazy stream

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
lhs %..% rhs

liota(n = Inf, start_ = 0L, step_ = 1L)

larith(start_, next_, end_ = Inf)

lrange(start_ = 0L, step_ = 1L, end_ = Inf)

lseq_gen1(x0, f)

lseq_gen2(x0, x1, f)

lseq_gen3(x0, x1, x2, f)

lseq_gen(..., f)

Arguments

lhs

numeric which is converted to integer

rhs

numeric which is converted to integer

n

number of elements

start_

start value

step_

step value

next_

next value

end_

env value

x0, x1, x2

initial values for generating function f

f

a function for lseq_gen

...

arguments for f

Examples

1
2
3
4
5
6
7
8
x <- 1 %..% 3
y <- 4 %..% 5
z <- x %++% y # => llist(1, 2, 3, 4, 5)

liota(5) # => llist(0, 1, 2, 3, 4)
larith(0, 2, 10) # => llist(0, 2, 4, 6, 8, 10)
lseq_gen(0, 1, f = function(x, y) x + y) # => fibonacci sequence
lseq_gen1(list(0, 1), f = function(xs) list(xs[[2]], xs[[1]]+ xs[[2]]))

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