Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import Data.List
- -- 1
- counteven lst = (length (filter even lst))
- -- 2
- takeMax lst = length (takeWhile (< maximum lst) lst)
- --3
- insertE lst n | elem n lst = lst
- | otherwise = let new = span ( < n ) lst in
- ( (fst new ) ++ [n] ++ (snd new) )
- -- 4
- sortedLst lst = sort lst == lst
- --5
- secondMax lst = maximum (filter ( /= (maximum lst) ) lst)
- --7
- maxPos lst = fst ( foldl(\(mx,k) el -> if el > 0 then (mx,k+1)
- else
- if mx > k then (mx,0)
- else (k,0) )
- (0,0) (lst ++ [(-1)]))
- --6
- shell lst = let
- new = transpose lst
- a = map maximum new
- b = map minimum new
- in a:[b]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement