SHARE
TWEET

Practice

a guest Jan 24th, 2020 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Problem:
  3.  * We would like to reverse sentences by keeping them readable but changing the meaning
  4.  * For instance, after apply your function on `you can cage a swallow can't you`
  5.  * you must get: `you can't swallow a cage can you`.
  6.  *
  7.  * We want solve every problem separaltely rather than create a tightly coupled function which only can solve one problem.
  8.  *
  9.  * To ease the pain of defining this problems, you take the functions headers and some docs for granted:
  10.  *
  11.  * words :: String -> List String
  12.  * This function should take a string and return a list with each word
  13.  *
  14.  * ---
  15.  *
  16.  * reverse :: List a -> List a
  17.  * This function should take a list of any type and reverse it by creating a new list with the same type of List a
  18.  *
  19.  * ---
  20.  *
  21.  * unwords :: List String -> String
  22.  * This function should take a List of strings and join it into a string with separating spaces
  23.  *
  24.  * ---
  25.  *
  26.  * reverseLine :: String -> String
  27.  * This function should take a string sentence and must return it reversed, changing the meaning
  28.  *
  29.  * In this last one, think how you can take advantage of the others functions.
  30.  * Can you compose them in some way to solve the problem?
  31.  *
  32.  *
  33.  * Tips: Try to use point-free style when you compose your functions.
  34.  *
  35.  */
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top