I loved the week two work - declaring Set as Int => Boolean and then implementing various set operations using hofs. Super good fun.
I didn't sign up for the course, but I helped a lot of people asking
about the "balanced parentheses?" problem. To me, it is clearly a
problem that is best solved using forallM on the State monad, where the
state value denotes the number of opened left-parentheses. So I went
ahead and solved it that way.
We can denote "the number of opened parentheses" with a natural number
type, which is just List[Unit]. That is, we cons a Unit value each time
we see ( and we tail each time we see ). This is quite similar to many
solutions that I saw, except they used Int instead of List[Unit]. I like
especially-safe type-safety :)
type Nat = List[Unit]
Actually, I have some further thoughts on this course:
One of the exercises in week 2 requires you to generalize Sum and Product methods.
Then the week 2 problems highlighted the difference in capabilities of Sets defined via a membership test ("intensionally") or via enumerating it's members ("extensionally"). Especially in the problem where you have to define a map() method across a Set.
All this is done without mention of Monoid or Functor. The course teaches the concepts, but then omits the commonly recognised name for the concepts that it introduces. Is this helpful? Is there a risk that student's do the problems, but miss out on a deeper understanding of, and language for, the patterns they encounter? Or is the important learning in the doing, and the names of patterns a distraction?
-Ben
PS can an intensionally-defined Set be a Functor?
I am only a teacher to the extent that I have done teaching. I remember believing that hiding terminology from students was a good idea. I was partly influenced by students themselves. Some students still insist. We were all wrong and not just a bit. I must remember to dismiss their demands, for everyone's benefit.
--
You received this message because you are subscribed to the Google Groups "Melbourne Scala User Group" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/scala-melb/-/Cgx-9Edv8uAJ.
-- Tony Morris http://tmorris.net/
well, without proper value data types in the JVM if you lived solely on Ben's non-OO orthogonal axis you'd be relegated to resorting to use tuples for everything - which would feel clunky IMO. I guess you could still declare classes as purely data structures and not give them any methods at all
- I guess you throw away traits then as well?