DList

final
class DList[A]

Difference lists: a data structure for O(1) append on lists. Based on Data.DList, a Haskell library by Don Stewart.

A difference list is a function that given a list, returns the original contents of the difference list prepended at the given list.

This structure supports O(1) append and snoc operations on lists, making it very useful for append-heavy uses, such as logging and pretty printing.

Companion
object
class Object
trait Matchable
class Any

Value members

Concrete methods

def ++(as: => DList[A]): DList[A]

Append one list to another in constant time.

Append one list to another in constant time.

def +:(a: A): DList[A]

Prepend a single element in constant time.

Prepend a single element in constant time.

def :+(a: A): DList[A]

Append a single element in constant time.

Append a single element in constant time.

def apply(xs: => IList[A]): Trampoline[IList[A]]
def flatMap[B](f: A => DList[B]): DList[B]

Map over a difference list, then flatten.

Map over a difference list, then flatten.

def foldr[B](z: => B)(f: (A, => B) => B): B

Fold over a difference list.

Fold over a difference list.

def headOption: Option[A]

Get the first element of the list, if any.

Get the first element of the list, if any.

def isEmpty: Boolean

Tests whether list is empty.

Tests whether list is empty.

def map[B](f: A => B): DList[B]

Map over a difference list.

Map over a difference list.

def tailOption: Option[DList[A]]

Get the tail of the list, if any.

Get the tail of the list, if any.

def toIList: IList[A]

Convert to an IList.

Convert to an IList.

def toList: List[A]

Convert to a normal list.

Convert to a normal list.

def uncons[B](z: => B, f: (A, DList[A]) => B): B

List elimination of head and tail.

List elimination of head and tail.

def zip[B](bs: => DList[B]): DList[(A, B)]