plutus-tx-1.46.0.0: Libraries for Plutus Tx and its prelude
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusTx.Data.List.TH

Synopsis

Documentation

destructList Source #

Arguments

String

Prefix of the generated bindings

Set Int

Element ids you need, starting from 0

Name

The builtin list to destruct

ExpQ

The computation that consumes the elements

ExpQ 

Generate variables bound to the given indices of a BuiltinList.

Sample Usage:

  f :: List Integer -> Integer
  f list =
  $( destructList
       "s"
       (Set.fromList [1, 4, 5])
       'list
       [|s1 + s4 + s5|]
   )

This computes the sum of list elements at indices 1, 4 and 5.