Advanced Functional Prog.


Exercises

  1. The concept of "isomorphism" means that two datatypes represent a "same" information. An isomorphism is defined by an invertible transformation/function. For instance, The functions (int,char) define isomorphism between integer and characters.
    • What will be the value of char (int 'a') ?
    • How to test if a letter corresponds to a digit '0','1',...'9' ?
    • How to get the numerical value of a digit ?
  2. Find how to define an isomorphism between string and char list.
    • How to count 'a' in a string ?
    • How to get count of all letters in a string ?
    • How to "(de)crypt" letters from a string ?
  3. How to represent a clock hour:minutes in F# ? Can you propose an isomorphic datatype ?
    • How to model a log history ?
    • How to get the hour with the maximum activity ?

['a;'b'] |> List.map string | List.reduce (+)

9 - 9