basic_functions: Extract the element of a lazy stream

Description Usage Arguments Examples

Description

function names come from Haskell. lcar and lcdr are renames of lhead and ltail but not recommended to use to avoid mixture of Haskell and Scheme.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
lhead(x)

ltail(x)

linit(x)

llast(x)

lcar(x)

lcdr(x)

Arguments

x

a lazy stream objects, which must not be lempty

Examples

1
2
3
4
5
6
7
8
9
x <- llist(1, 2, 3)
lhead(x) # => 1
ltail(x) # => llist(2, 3)
linit(x) # => llist(1, 2)
llast(x) # => 3

## Not run: lhead(lempty)
tryCatch(lhead(lempty), error = function(e) print(e))
# => <simpleError in lhead(lempty): empty list>

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