- Imagine that your boss asks you to implement a function named
grkand that its type must be exactly
string -> bool. In other words, the toplevel would print the following when queried about the function:
# grk;; grk : string -> bool = <fun>
Use the toplevel to investigate which of the following would be permitted by your boss’s request, and which would not:
grka recursive function.
grka non-recursive function.
- Writing a helper function and using that helper function in the body of
stringargument a labelled argument.
Compare and contrast OCaml functions to functions in another language of your choice, focusing on those concepts: recursive vs. non-recursive, anonymous, polymorphism, and partial application.
- One of the premises of functional programming is that mathematical functions are the basic building block of computation. How are OCaml functions like mathematical functions? How are they different? As part of your answer, focus on the notion of types. In your opinion, is mathematics itself typed or untyped?
Submit your answers to CMS.