plutus-core-1.36.0.0: Language library for Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusCore.StdLib.Data.List

Description

Built-in list and related functions.

Synopsis

Documentation

list ∷ uni `HasTypeLevel` ListType tyname uni () Source #

[] as a built-in PLC type.

caseListTermLike term TyName Name DefaultUni DefaultFun ⇒ term () Source #

Pattern matching on built-in lists. caseList {a} xs on built-in lists is equivalent to unwrap xs on lists defined in PLC itself (hence why we bind r after xs).

/\(a :: *) -> \(xs : list a) -> /\(r :: *) -> (z : r) (f : a -> list a -> r) ->
    chooseList
        {a}
        {() -> r}
        xs
        (\(u : ()) -> z)
        (\(u : ()) -> f (head {a} xs) (tail {a} xs))
        ()

foldrListTermLike term TyName Name DefaultUni DefaultFun ⇒ term () Source #

foldr over built-in lists.

/\(a :: *) (r :: *) -> \(f : a -> r -> r) (z : r) ->
    fix {list a} {r} \(rec : list a -> r) (xs : list a) ->
        caseList {a} xs {r} z \(x : a) (xs' : list a) -> f x (rec xs')

foldListTermLike term TyName Name DefaultUni DefaultFun ⇒ term () Source #

'foldl'' as a PLC term.

/\(a :: *) (r :: *) -> \(f : r -> a -> r) ->
    fix {r} {list a -> r} \(rec : r -> list a -> r) (z : r) (xs : list a) ->
        caseList {a} xs {r} z \(x : a) (xs' : list a) -> rec (f z x) xs'

productTermLike term TyName Name DefaultUni DefaultFun ⇒ term () Source #

product as a PLC term.

foldList {integer} {integer} multiplyInteger 1