DifferenceLists.DLType
DL(func)

Given function func, construct a difference list.

Difference lists are highly efficient, immutable, concatenate and prepend in constant time, and iterate in time N.

Examples

julia> [x for x = dl(1, 2, 3)]
3-element Array{Int64,1}:
 1
 2
 3
DifferenceLists.DLMethod
(a::DL)(lists::DL...)::DL

A difference list itself can be used as shorthand for concat.

See also: dl, concat

Examples

julia> dl(1, 2)(dl(3, 4), dl(5, 6, 7))
dl(1, 2, 3, 4, 5, 6, 7)
DifferenceLists.concatMethod
concat(lists::DL...)::DL

Concatenate difference lists in constant time

See also: dl

Examples

julia> concat(dl(1, 2), dl(3, 4))
dl(1, 2, 3, 4)

julia> concat(dl(1), dl(2))
dl(1, 2)
DifferenceLists.dlMethod
dl()::DL
dl(items...)::DL

Construct a difference list of items.

Examples

julia> dl()
dl()

julia> dl(1)
dl(1)

julia> dl(1, 2, 3)
dl(1, 2, 3)

julia> dl(1, dl(2, 3), 4)
dl(1, dl(2, 3), 4)
DifferenceLists.pushMethod
push(item, dl::DL)

Push an item onto the end of a difference list.

Examples

julia> push(2, push(1, dl(7, 8, 9)))
dl(7, 8, 9, 1, 2)
DifferenceLists.pushfirstMethod
pushfirst(item, dl::DL)

Push an item onto the front of a difference list.

Examples

julia> pushfirst(1, pushfirst(2, dl(7, 8, 9)))
dl(1, 2, 7, 8, 9)
DifferenceLists.todlMethod
todl(items)

Create a difference list from something you can iterate over

Examples

julia> todl([1, 2, 3])
dl(1, 2, 3)
DifferenceLists.nextForMethod
nextFor(items, state, last)

Compute the next iteration value for an embedded collection.