From dddbde52aed9291e19fcc0adf2aa3830eae92727 Mon Sep 17 00:00:00 2001 From: Rik Bose <88793134+infiniterik@users.noreply.github.com> Date: Tue, 18 Oct 2022 21:55:40 -0500 Subject: [PATCH 1/3] inconsistent naming --- readme.org | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.org b/readme.org index 8320777..12ed905 100644 --- a/readme.org +++ b/readme.org @@ -11,15 +11,15 @@ 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 -x = (List [Value 3, List [Value 2, Value 3], Value 4]) +x = (NestedList [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 From 7e8e6a6ac42159e8ac8430daa5759af0dade0be7 Mon Sep 17 00:00:00 2001 From: Rik Bose <88793134+infiniterik@users.noreply.github.com> Date: Wed, 19 Oct 2022 13:41:01 -0500 Subject: [PATCH 2/3] Update readme.org --- readme.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.org b/readme.org index 12ed905..4920764 100644 --- a/readme.org +++ b/readme.org @@ -16,7 +16,7 @@ data NestedList a = Value a | List [NestedList a] Which can be instantiated as follows: #+BEGIN_SRC haskell -x = (NestedList [Value 3, List [Value 2, Value 3], Value 4]) +x = (NestedList [Value 3, NestedList [Value 2, Value 3], Value 4]) #+END_SRC Implement ~deepsum!~ on an instance of ~NestedList~ instead of arbitrarily nested lists. From 13d15a9d87d4b5312142a458996b7f18f47b9789 Mon Sep 17 00:00:00 2001 From: Rik Bose <88793134+infiniterik@users.noreply.github.com> Date: Thu, 20 Oct 2022 00:02:27 -0500 Subject: [PATCH 3/3] added explanation --- readme.org | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/readme.org b/readme.org index 4920764..9b0717e 100644 --- a/readme.org +++ b/readme.org @@ -16,10 +16,12 @@ data NestedList a = Value a | List [NestedList a] Which can be instantiated as follows: #+BEGIN_SRC haskell -x = (NestedList [Value 3, NestedList [Value 2, Value 3], Value 4]) +-- 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 ~NestedList~ 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