DifferenceLists.DL
— TypeDL(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.DL
— MethodDifferenceLists.concat
— Methodconcat(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.dl
— Methoddl()::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.push
— Methodpush(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.pushfirst
— Methodpushfirst(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.todl
— Methodtodl(items)
Create a difference list from something you can iterate over
Examples
julia> todl([1, 2, 3])
dl(1, 2, 3)
DifferenceLists.nextFor
— MethodnextFor(items, state, last)
Compute the next iteration value for an embedded collection.