diff --git a/readme.org b/readme.org index 8320777..9b0717e 100644 --- a/readme.org +++ b/readme.org @@ -11,15 +11,17 @@ The pre-defined procedures ~min~ and ~max~ each take two arguments and return th Implement ~deepSum~, where given an instance of ~Nested~, defined below, an arbitrarily nested list of numbers, ~deepSum~ the sum of all the numbers. That is, your input list may have sublists, which may themselves have sublists and so on. #+BEGIN_SRC haskell -data Nested a = Value a | List [NestedList a] +data NestedList a = Value a | List [NestedList a] #+END_SRC Which can be instantiated as follows: #+BEGIN_SRC haskell +-- while x is of the type NestedList, we never directly instantiate a NestedList +-- Instead, instantiate the types Value or List x = (List [Value 3, List [Value 2, Value 3], Value 4]) #+END_SRC -Implement deepsum on an instance of Nested instead of arbitrarily nested lists. +Implement ~deepsum~ on an instance of ~NestedList~ instead of arbitrarily nested lists. a. Haskell has stricter type requirements than Scheme did. What would be true of nested arrays in Haskell? b. Implement the function * Question 2 - Prime numbers