Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fun create [] = []
- | create (x::y) = (x,x)::(create y);
- exception nopepuntoexe;
- fun findAux x [] z = raise nopepuntoexe
- | findAux x ((a,b)::c) z =
- if x = a andalso a = b
- then
- b
- else
- if x = a
- then
- findAux b z z
- else
- findAux x c z
- fun find x a = findAux x a a;
- fun unionAux x y [] rest k = raise nopepuntoexe
- | unionAux x y ((a,b)::c) rest k = if k = a
- then
- rest@((a,x)::c)
- else
- unionAux x y c (rest@[(a,b)]) k;
- fun union x y a = unionAux x y a [] (find y a);
- val l = create([1,2,3,4,5,6]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement