Homework Week 1

Find last element in a list

> myLast [1,2,3,4]
Just 4

Find the last but one element of a list

> myButLast [1,2,3,4]
Just 3

Find the K’th element of a list

> elementAt [1,2,3] 2
Just 2

Find the number of elements of a list

> myLength [123, 456, 789]
3

Reverse a list

> myReverse [1,2,3,4]
[4,3,2,1]

Find out whether a list is a palindrome

> isPalindrome [1,2,4,8,16,8,4,2,1]
True

Eliminate consecutive duplicates of string elements

> compress "aaaabccaadeeee"
"abcade"

Drop every N’th element from a string

> dropEvery "abcdefghik" 3
"abdeghk"

(optional) Insert the emoji between words

> clap "learning Elm is fun"
"learning πŸ‘ Elm πŸ‘ is πŸ‘ fun"