12.07.2015 Views

CSCE 314 Programming Languages - TAMU Computer Science ...

CSCE 314 Programming Languages - TAMU Computer Science ...

CSCE 314 Programming Languages - TAMU Computer Science ...

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Exercises(1)Consider a function safetail that behaves inthe same way as tail, except that safetailmaps the empty list to the empty list, whereastail gives an error in this case. Define safetailusing:(a) "a conditional expression;(b) "guarded equations;(c) "pattern matching.Hint: the library function null :: [a] → Bool canbe used to test if a list is empty.20

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!