MFC/p3/5.3.maude

18 lines
363 B
Text
Raw Permalink Normal View History

2018-11-06 17:28:03 +01:00
reduce in FUN-TEST : eval(
let rec a = false and b = false
and f(l,x,y) =
if null?(l)
then { }
else {
if * x == false
then {* x := car(l) ; * y := car(l) }
else if * x <= car(l)
then * x := car(l)
else if * y >= car(l)
then * y := car(l)
;
f(cdr(l),x,y)
}
in { f([1, 2, 3, 4, 5], & a, & b) ; [a,b] }
).