ligo/src/test/contracts/tuple.ligo

24 lines
543 B
Plaintext
Raw Normal View History

2020-02-27 17:51:29 +01:00
type abc is int * int * int
2019-05-12 20:56:22 +00:00
2020-02-27 17:51:29 +01:00
function projection_abc (const tpl : abc) : int is tpl.1
2019-05-12 20:56:22 +00:00
function modify_abc (const tpl : abc) : abc is
block {
2020-02-27 17:51:29 +01:00
tpl.1 := 2048
2019-05-12 20:56:22 +00:00
} with tpl
2020-02-27 17:51:29 +01:00
type foobar is int * int
2019-05-12 20:56:22 +00:00
2020-02-27 17:51:29 +01:00
const fb : foobar = (0,0)
2019-05-12 20:56:22 +00:00
2020-02-27 17:51:29 +01:00
function projection (const tpl : foobar) : int is tpl.0 + tpl.1
2019-05-12 20:56:22 +00:00
2020-03-25 15:22:26 +01:00
type big_tuple is int * int * int * int * int * int * int * int * int * int * int * int
2019-05-12 20:56:22 +00:00
2020-03-25 15:22:26 +01:00
const br : big_tuple = (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
function update (const tpl : big_tuple) : big_tuple is
block {
tpl.11 := 2048
} with tpl