1: #line 683 "./lpsrc/flx_regress.pak"
2:
3:
4: open List;
5:
6: fun snd(x,y)=>y;
7: fun fst(x,y)=>x;
8:
9: fun index[t] (l:list[t]) = {
10: fun f(il:int * list [int * t]) (e: t) =>
11: match il with
12: | ?i,?l => i+1, Cons ((i, e),l)
13: endmatch
14: ;
15: return
16: rev (snd ( fold_left
17: f of (int * list[int *t])
18: (0, Empty[int * t])
19: l
20: ))
21: ;
22: }
23:
24: var x = Empty[int];
25: x = Cons(11,x);
26: x = Cons(22,x);
27: x = Cons(33,x);
28: x = Cons(44,x);
29: x = Cons(55,x);
30: x = Cons(66,x);
31:
32: val z = index x;
33: iter
34: (proc (x:int,y:int)
35: {
36: print x; print " -> "; print y; endl;
37: }
38: )
39: z
40: ;