Get the second element in a list of tuples?

The snd function returns the second item in a tuple (docs).

The following should do what you are looking for.

let payoutAmt  = betPayload.betSlip.wager * (snd payoutRate)

One feature of the docs.daml.com that I like particularly is looking for a function by signature: if you type (a, b) -> b in the search bar, you will find what you are looking for. In my example a and b are generic types, but searching by signature is smart enough to deal with generic types, so looking for (Text, Numeric 2) -> Numeric 2 will still return the answer you are looking for (even though snd is more generic than that).

1 Like