--returns the rightmost component of a list last= \ xs -> -- if xs == [] then [] -- else if tail xs == [] then head xs -- else last (tail xs) -- -- --checks if a list is sorted issorted = \ xs -> -- xs /= [] && -- ( -- tail xs == [] || -- ( -- head xs <= head(tail xs) && -- issorted(tail xs) -- ) -- ) -- -- --a list of the values lo to hi range = \ lo -> \ hi -> -- if hi < lo then [] -- else lo:(range (lo+1) hi) -- -- --a list of n copies of x copies = \ n -> \ x -> -- if n <= 0 then [] -- else x : (copies (n-1) x)--