18 lines
363 B
Text
18 lines
363 B
Text
|
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] }
|
||
|
).
|