Re: [Haskell-cafe] Teaching High-School one-semester FP (using Haskell)

Hi. Teaching is a topic that I do care about, and spend a lot of time on. I want to underline two points that Chris Smith made in his message about the ideas behind "Code World". I am speaking from current experience in teaching an "Intro to CS" course for non-CS students ("Informatik" on https://imweb.imn.htwk-leipzig.de/~waldmann/lehre.html)
easy graphics and UI library with a purely functional style. ... lets your students experience declarative programming and build cooI things easily, without needing to get bogged down in stuff like I/O [...] etc.
So much this! Have some basic pictures (rectangle, circle), combinators "row" (besides) and "column" (above), with some basic transformations. This will get students started with the algebraic method (description in the term algebra, evaluation in the domain algebra). I gave homework "produce pictures that resemble letters, traffic signs, etc." Does not need fancy graphics at all - I looked at the "diagrams" package but then decided to go with rectangular black/white pictures only. These restrictions make the "draw a sign" exercise more interesting. And after all, CS is about abstraction. It also allows me to connect to Boolean operations (combine pictures of identical sizes with point-wise Nand, etc.) that are treated in the lecture as well.
get bogged down in stuff like [...] recursion, etc.
Again, yes! For my current course, I indeed think that primitive recursion (that is, iteration) is quite enough. E.g., students can draw a chess board from a single white square by flipping the color, and iterated composition. (Of course a CS major should know about the halting problem - but only to avoid it when programming. A non-CS major shouldn't write programs at all.) Advertisment: So I made an experimental "sub-Haskell" language (with online interpreter, integrated into an auto-grading system) (source currently at https://gitlab.imn.htwk-leipzig.de/autotool/all0/-/tree/661-programmable-gra... - I should break it out) with drastically restricted features * just one type (Pictures) * "let" but it's not "letrec" - definitions cannot be recursive * functions but they must be named (no lambdas) * strict evaluation (except for if-then-else which is hard-coded) * just one hard-wired higher order functions: iterate :: (a -> a) -> Nat -> a -> a * well, here I need Nat, and for if-then-else I need Bool, so that's the other two domain types besides Picture * formal parameters of functions must have a type declaration * extensive tracing of evaluation * and check(For) for property-based testing * code with with holes, where students have to fill in the holes, but cannot change anything outside. I can switch off some features (e.g., no functions, or, just unary) and I can switch the underlying domain: instead of pictures, can use sequences (it's not too much of a difference, a sequence is just a one-dimensional picture). I will use this for showing (one method of) compression: find a short straight-line program that produces a given string. Also I was thinking of introducing the "music" domain (scores/performances as in Haskore/Euterpea) but I am undecided about the best way of rendering MIDI in the browser (without 3rd-party JS, see below). Perhaps it doesn't have to be rendered (just print the events) as CS is about abstraction ... So while I try to stay in a Haskell subset (syntactically and semantically) the goal is not to teach some concrete programming language but algebraic/structural thinking. That is, mathematical thinking. Not "computational thinking" - because there is no such thing. If it works, it *is* mathematical... - J.W. NB: another necessary goal of an "intro to all things computer/computing" course is to make students aware of the surveillance economy. Fits nicely in the "computer networks" chapter.
... get your students started quickly and easily in class, without waiting for them to install GHC, Cabal/Stack, etc.
Yes. That's hard even for CS majors. Well and for me as well. I normally provide software installed in the computer pool, but .. cf. https://github.com/haskell/cabal/issues/7172 Of course "the browser is the OS" is what Evil Corp wants students and teachers to think ..
participants (1)
-
Johannes Waldmann