ligo/test/contracts/max_in_list.tz

11 lines
284 B
Plaintext
Raw Normal View History

parameter (list int);
2017-07-24 17:06:56 +04:00
storage unit;
return (option int);
code {CAR; DIP{NONE int};
2017-07-24 17:06:56 +04:00
LAMBDA
(pair int (option int))
(option int)
{DUP; DUP; CAR; SWAP; CDR;
2017-07-24 17:06:56 +04:00
IF_NONE {DIP{DROP}; SOME} {CMPGT; IF {CDR} {CAR; SOME}}};
REDUCE; UNIT; SWAP; PAIR};