Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main = return ()
- getElements list =
- case list of
- h:t -> if length list == 1 then
- []
- else
- [h]++getElements t
- _ -> []
- palindrom list left right =
- if left>=right then
- 1
- else
- if list !! left == list !! right then
- palindrom list (left+1) (right-1)
- else
- -1
- splosci list =
- case list of
- [] -> []
- h:t -> h++(splosci t)
- getEl2 list from to =
- if from == to then
- []
- else
- [list !! from] ++ (getEl2 list (from+1) to)
- swapElements list i j =
- if i == j then
- list
- else if i < j then
- (getEl2 list 0 i)++[list !! j]++(getEl2 list (i+1) j)++[list !! i]++(getEl2 list (j+1) (length list))
- else
- (getEl2 list 0 j)++[list !! i]++(getEl2 list (j+1) i)++[list !! j]++(getEl2 list (i+1) (length list))
- createList n e =
- if e == (n-1) then
- [e]
- else
- [e]++(createList n (e+1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement