/* stdlib - may 97 - par Sylvain Huet */ fun apply_on_list(l,f,x)= if l==nil then 0 else let l -> [a nxt] in (exec f with [a x]; apply_on_list nxt f x);; fun rev_apply_on_list(l,f,x)= if l==nil then 0 else let l -> [a nxt] in (rev_apply_on_list nxt f x; exec f with [a x];0);; fun search_in_list(l,f,x)= if l==nil then nil else let l -> [a nxt] in if exec f with [a x] then a else search_in_list nxt f x;; fun remove_from_list(l,p)= if l==nil then nil else let l -> [a nxt] in if a==p then nxt else a::remove_from_list nxt p;; fun pos_in_list(l,p,n)= if l==nil then nil else let l -> [a nxt] in if a==p then n else pos_in_list nxt p n+1;; fun create_tab(n,f,x)= let mktab n nil -> t in (let 0->i in while i l in if f==nil then [l l] else let f->[a b] in (mutate b<-[_ l]; [a l]);; fun getFifo(f)= if f==nil then [nil nil] else let f->[a b] in if a==b then [hd a nil] else [hd a [tl a b]];; fun sizeFifo(f)= if f==nil then 0 else let f->[a _] in sizelist a;; fun concFifo(f,g)= if f==nil then g else if g==nil then f else let f->[a b] in let g->[c d] in (mutate b<-[_ c]; [a d]);;