ligo/test/contracts/append.tz

16 lines
542 B
Plaintext

parameter (pair (list int) (list int));
return (list int);
storage unit;
code { CAR; DUP; DIP{CDR}; CAR; # Unpack lists
NIL int; SWAP; # Setup reverse accumulator
LAMBDA (pair int (list int))
(list int)
{DUP; CAR; DIP{CDR}; CONS};
REDUCE; # Reverse list
LAMBDA (pair int (list int))
(list int)
{DUP; CAR; DIP{CDR}; CONS};
REDUCE; # Append reversed list
UNIT; SWAP; PAIR} # Calling convention