fun ander [] = true | ander (h::t) = h andalso ander t ; fun spansv [] b test = (b,[]) | spansv a b test = if test (hd a) then spansv (tl a) (b@[hd a]) test else (b,a) ; fun span nil test = ([],[]) | span ls test = spansv ls [] test ; fun alternating_sum [] = 0 | alternating_sum (h::t) = h - alternating_sum t ; fun isEmpty [] = true | isEmpty stk = false ; fun push x stk = x::stk; fun pop (top::stk) = (stk,top); fun multipush [] stk = stk | multipush lst stk = multipush (tl lst) (push (hd lst) stk) ; fun multipopsv 0 stk sv = (stk,sv) | multipopsv n stk sv = multipopsv (n-1) (tl stk) ( sv@[hd stk] ) ; fun multipop n stk = multipopsv n stk [];