Define the combine function which, when given a pair of lists, returns a list of pairs such that:
combine ([x1;...;xn],[y1;...;yn]) = [(x1,y1);...;(xn,yn)]
let rec combine = function ([],[])->[] | (x1::rest1,x2::rest2)->(x1,x2)::combine (rest1,rest2) | _->raise (Failure "combine");; combine ([1;2;3;4],[5;6;7;8]);;
Define a function which, when given a list, returns the list of all its sublists.
let rec sublists = function []->[[]] | l -> let rec headlists = function []->[] | x::rest -> [x]::(map (function l -> x::l) (headlists rest)) in append (headlists l, sublists (tail l));; sublists [1;2;3;4];;