ligo/test/contracts/max_in_list.tz

11 lines
284 B
Plaintext

parameter (list int);
storage unit;
return (option int);
code {CAR; DIP{NONE int};
LAMBDA
(pair int (option int))
(option int)
{DUP; DUP; CAR; SWAP; CDR;
IF_NONE {DIP{DROP}; SOME} {CMPGT; IF {CDR} {CAR; SOME}}};
REDUCE; UNIT; SWAP; PAIR};