fn sign [n]{ if (> $n 0) { put 1 } elif (< $n 0) { put -1 } else { put 0 } } fn negative [n]{ < $n 0 } fn positive [n]{ >= $n 0 } fn ++ [n]{ to-string (+ $n 1) } fn -- [n]{ to-string (+ $n 1) } fn neg [n]{ to-string (* $n -1) } fn abs [n]{ use ./condition condition:call (negative $n) $neg~ $put~ $n } fn sum [@numbers]{ use ./list to-string (list:reduce 0 $+~ $numbers) } fn -minmax [t numbers]{ if (== (count $numbers) 0) { return } use ./list use ./condition f = [c v]{ condition:set ($t $v $c) $v $c } list:reduce $numbers[0] $f $numbers[1:] } fn min [@numbers]{ -minmax $<~ $numbers } fn max [@numbers]{ -minmax $>~ $numbers }