Cons

scalus.uplc.builtin.BuiltinList.Cons
final case class Cons[+A](h: A, tl: BuiltinList[A]) extends BuiltinList[A]

Members list

Value members

Inherited methods

def ::[B >: A](x: B): BuiltinList[B]

Prepends an element to the list.

Prepends an element to the list.

Corresponds to UPLC builtin mkCons.

Value parameters

x

the element to prepend

Attributes

Returns

a new list with x as the first element

Inherited from:
BuiltinList
def head: A

Returns the first element of the list.

Returns the first element of the list.

Corresponds to UPLC builtin headList.

Attributes

Returns

the first element

Throws
NoSuchElementException

if the list is empty

Inherited from:
BuiltinList
def isEmpty: Boolean

Checks if the list is empty.

Checks if the list is empty.

Corresponds to UPLC builtin nullList.

Attributes

Returns

true if the list has no elements

Inherited from:
BuiltinList
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product
def tail: BuiltinList[A]

Returns all elements except the first.

Returns all elements except the first.

Corresponds to UPLC builtin tailList.

Attributes

Returns

a new list without the first element

Throws
NoSuchElementException

if the list is empty

Inherited from:
BuiltinList
def toList: List[A]

Converts to a Scala immutable List.

Converts to a Scala immutable List.

This is an offchain operation for interoperability with Scala collections.

Attributes

Inherited from:
BuiltinList