Teaching High-School one-semester FP (using Haskell)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

Teaching High-School one-semester FP (using Haskell)

Zachi Baharav
Dear mighty Haskell list,

I am a high-school teacher in the US (California, Palo Alto). We have an advanced CS course that students can take after completing the AP-CS-A (in Java). This is usually Juniors and Seniors, after at least 2 or 3 courses of coding (Python+Java). Traditionally, I've done a potpourri of subjects, mostly search algorithms as applied to 'games'. Of course a little bit of data-structure comes in, and each year we did some 'other' interesting subject (like halftoning, barcodes, and so on) and investigated and implemented algorithms there.

THIS year, for the second half, I would like us to do Functional-Programming. From what I have seen, my students over the years tend to write more and more convoluted codes, electing first to search on stackOverFlow for some similar pattern, rather than think and find a concise and clean solution. I think FP would supply them with a new way of thinking, which will help with whatever they will write later on.

I've been coding with Haskell for about 7 years, so feel ok leading the class.

The question: I have many books on Haskell (i think 'all', but who knows.  Haskell, Real world Haskell, Learn you a haskell for great good, programming in haskell, and many more). 
--->  I am looking for something more hands-on and 'fun' for HS students. may i say the buzzword 'project based', or maybe better 'problem based' for our case.
Something that I could teach a little, and then we can solve a bunch of problems, and teach a little more, and so on.

It doesn't have to be a Book!!  Just an outline of a course someone did with associated bunch of problems would be awesome. We have 18 weeks in a semester. My thought right now (if I don't find anything) is to relyon Euler project early problems. These are often clean and simple in Haskell.  Or otherwise some CSES problems (which we've done in Java).

Ok, long enough email.

If you have material and can share here, great! 
If you have material and want to reach out privately, please do ([hidden email]).
If you have a good pointer, that would be appreciated.

Thanks in advance for any help!
   Zachi
(Dr. Zachi Baharav, HS teacher  (after 20 years in Industry and academia))








_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

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

Gregory Guthrie-2

Nice situation and goal.

 

I have seen several nice books in Python which make programming and problem solving fun – perhaps you coud adapt one of them, but code in Python – end up with a book for further reuse! Or just use the basic tone and approach.

 

“Impractical Python: Projects Playful Programming Activities to Make You Smarter”

Playful Programming - Python at Home”

 

 

 

Dr. Gregory Guthrie

Maharishi International University

----------------------------------------------------------------

 

From: Haskell-Cafe <[hidden email]> On Behalf Of Zachi Baharav
Sent: Thursday, December 10, 2020 3:55 PM
To: Haskell Cafe <[hidden email]>
Subject: [Haskell-cafe] Teaching High-School one-semester FP (using Haskell)

 

Dear mighty Haskell list,

 

I am a high-school teacher in the US (California, Palo Alto). We have an advanced CS course that students can take after completing the AP-CS-A (in Java). This is usually Juniors and Seniors, after at least 2 or 3 courses of coding (Python+Java). Traditionally, I've done a potpourri of subjects, mostly search algorithms as applied to 'games'. Of course a little bit of data-structure comes in, and each year we did some 'other' interesting subject (like halftoning, barcodes, and so on) and investigated and implemented algorithms there.

 

THIS year, for the second half, I would like us to do Functional-Programming. From what I have seen, my students over the years tend to write more and more convoluted codes, electing first to search on stackOverFlow for some similar pattern, rather than think and find a concise and clean solution. I think FP would supply them with a new way of thinking, which will help with whatever they will write later on.

 

I've been coding with Haskell for about 7 years, so feel ok leading the class.

 

The question: I have many books on Haskell (i think 'all', but who knows.  Haskell, Real world Haskell, Learn you a haskell for great good, programming in haskell, and many more). 

--->  I am looking for something more hands-on and 'fun' for HS students. may i say the buzzword 'project based', or maybe better 'problem based' for our case.

Something that I could teach a little, and then we can solve a bunch of problems, and teach a little more, and so on.

 

It doesn't have to be a Book!!  Just an outline of a course someone did with associated bunch of problems would be awesome. We have 18 weeks in a semester. My thought right now (if I don't find anything) is to relyon Euler project early problems. These are often clean and simple in Haskell.  Or otherwise some CSES problems (which we've done in Java).

 

Ok, long enough email.

 

If you have material and can share here, great! 

If you have material and want to reach out privately, please do ([hidden email]).

If you have a good pointer, that would be appreciated.

 

Thanks in advance for any help!

   Zachi

(Dr. Zachi Baharav, HS teacher  (after 20 years in Industry and academia))

 

 

 

 

 

 

 


_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

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

Albert Y. C. Lai
In reply to this post by Zachi Baharav
I think that the 99 Haskell Problems are an easy source of short exercises.

https://wiki.haskell.org/H-99:_Ninety-Nine_Haskell_Problems

For longer, well-motivated problems, I think of the long-running
examples in textbooks, for example the Countdown chapter in Hutton's
Programming in Haskell.

If you can find/borrow Lawrence Paulson's ML for The Working Programmer,
it has a list of suggested projects near the end.  Don't worry about how
that book is on ML rather than Haskell, most of its exercises and
projects are good for Haskell too.  In fact, enjoy this sentence from
the book: "This sort of thing is easier in Haskell". :)

And now a dark turn---every silver lining has tarnish.

FP does not change people from writing convoluted borrowed code to
original simple code.  I saw this in my students, their only difference
from your dis they are in university.  Everything you said about having
gone through Python and Java, fishing for answers on Stackoverflow, and
making a mess, is just as true of my students.  And to think that
they're university students, yes.

In fact, it may be even worse, now that recursion is compulsory.  People
distrust recursion, they will think up all kinds of crazy schemes to
micromanage code execution, rather than just letting recursion do its job.

In fact, even worse when the language is Haskell instead of SML and
OCaml, because of "how do I print debugging output?"


On 2020-12-10 4:55 p.m., Zachi Baharav wrote:

> Dear mighty Haskell list,
>
> I am a high-school teacher in the US (California, Palo Alto). We have an
> advanced CS course that students can take after completing the AP-CS-A
> (in Java). This is usually Juniors and Seniors, after at least 2 or 3
> courses of coding (Python+Java). Traditionally, I've done a potpourri of
> subjects, mostly search algorithms as applied to 'games'. Of course a
> little bit of data-structure comes in, and each year we did some 'other'
> interesting subject (like halftoning, barcodes, and so on) and
> investigated and implemented algorithms there.
>
> THIS year, for the second half, I would like us to do
> Functional-Programming. From what I have seen, my students over the
> years tend to write more and more convoluted codes, electing first to
> search on stackOverFlow for some similar pattern, rather than think and
> find a concise and clean solution. I think FP would supply them with a
> new way of thinking, which will help with whatever they will write later on.
>
> I've been coding with Haskell for about 7 years, so feel ok leading the
> class.
>
> The question: I have many books on Haskell (i think 'all', but who
> knows.  Haskell, Real world Haskell, Learn you a haskell for great good,
> programming in haskell, and many more).
> --->  I am looking for something more hands-on and 'fun' for HS
> students. may i say the buzzword 'project based', or maybe better
> 'problem based' for our case.
> Something that I could teach a little, and then we can solve a bunch of
> problems, and teach a little more, and so on.
>
> It doesn't have to be a Book!!  Just an outline of a course someone did
> with associated bunch of problems would be awesome. We have 18 weeks in
> a semester. My thought right now (if I don't find anything) is to relyon
> Euler project early problems. These are often clean and simple in
> Haskell.  Or otherwise some CSES problems (which we've done in Java).
>
> Ok, long enough email.
>
> If you have material and can share here, great!
> If you have material and want to reach out privately, please do
> ([hidden email] <mailto:[hidden email]>).
> If you have a good pointer, that would be appreciated.
>
> Thanks in advance for any help!
>     Zachi
> (Dr. Zachi Baharav, HS teacher  (after 20 years in Industry and academia))
>
>
>
>
>
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

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

Henning Thielemann

On Thu, 10 Dec 2020, Albert Y. C. Lai wrote:

> In fact, it may be even worse, now that recursion is compulsory.  People
> distrust recursion, they will think up all kinds of crazy schemes to
> micromanage code execution, rather than just letting recursion do its job.

My experience is that students see in the first lession how recursion
works and then stop learning new concepts. They keep coding every 'map',
'filter' and 'foldl' manually as recursion. So recursion looks to me as
funtional programming's GOTO, and if it is tail recursive, it actually is
one.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

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

Albert Y. C. Lai
In reply to this post by Albert Y. C. Lai
On 2020-12-10 6:58 p.m., Albert Y. C. Lai wrote:
> In fact, even worse when the language is Haskell instead of SML and
> OCaml, because of "how do I print debugging output?"

Speaking of which, this is my debugging output tutorial:

http://www.vex.net/~trebla/haskell/tracing.html

Students seeing that early won't have to go through the rabbit hole of
Googling for "how to print in haskell" (beginners can't know upfront
that the correct Googling is "how to debug print in haskell") and
getting very distracted.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

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

Gregory Guthrie-2
In reply to this post by Albert Y. C. Lai
This may be superfluous in this forum, but my suggestion for a good approach to the copying/searching problem is to have students first make a pseudo-code design of a solution, and then build small parts of that algorithm, and then incrementally assemble them into a solution.

That way they wouldn't find an online solution which matches their individual pre-submitted components, and it emphasizes the constructive (compositional) nature of modular software good practice, and how well FP supports that.

One can then give incremental changes to the functional requirements, which impact some of the components, but not the overall composed design.

Dr. Gregory Guthrie
Maharishi International University
----------------------------------------------------------------

-----Original Message-----
From: Haskell-Cafe <[hidden email]> On Behalf Of Albert Y. C. Lai
Sent: Thursday, December 10, 2020 5:58 PM
To: [hidden email]
Subject: Re: [Haskell-cafe] Teaching High-School one-semester FP (using Haskell)

I think that the 99 Haskell Problems are an easy source of short exercises.

https://wiki.haskell.org/H-99:_Ninety-Nine_Haskell_Problems

For longer, well-motivated problems, I think of the long-running examples in textbooks, for example the Countdown chapter in Hutton's Programming in Haskell.

If you can find/borrow Lawrence Paulson's ML for The Working Programmer, it has a list of suggested projects near the end.  Don't worry about how that book is on ML rather than Haskell, most of its exercises and projects are good for Haskell too.  In fact, enjoy this sentence from the book: "This sort of thing is easier in Haskell". :)

And now a dark turn---every silver lining has tarnish.

FP does not change people from writing convoluted borrowed code to original simple code.  I saw this in my students, their only difference from your dis they are in university.  Everything you said about having gone through Python and Java, fishing for answers on Stackoverflow, and making a mess, is just as true of my students.  And to think that they're university students, yes.

In fact, it may be even worse, now that recursion is compulsory.  People distrust recursion, they will think up all kinds of crazy schemes to micromanage code execution, rather than just letting recursion do its job.

In fact, even worse when the language is Haskell instead of SML and OCaml, because of "how do I print debugging output?"


On 2020-12-10 4:55 p.m., Zachi Baharav wrote:

> Dear mighty Haskell list,
>
> I am a high-school teacher in the US (California, Palo Alto). We have an
> advanced CS course that students can take after completing the AP-CS-A
> (in Java). This is usually Juniors and Seniors, after at least 2 or 3
> courses of coding (Python+Java). Traditionally, I've done a potpourri of
> subjects, mostly search algorithms as applied to 'games'. Of course a
> little bit of data-structure comes in, and each year we did some 'other'
> interesting subject (like halftoning, barcodes, and so on) and
> investigated and implemented algorithms there.
>
> THIS year, for the second half, I would like us to do
> Functional-Programming. From what I have seen, my students over the
> years tend to write more and more convoluted codes, electing first to
> search on stackOverFlow for some similar pattern, rather than think and
> find a concise and clean solution. I think FP would supply them with a
> new way of thinking, which will help with whatever they will write later on.
>
> I've been coding with Haskell for about 7 years, so feel ok leading the
> class.
>
> The question: I have many books on Haskell (i think 'all', but who
> knows.  Haskell, Real world Haskell, Learn you a haskell for great good,
> programming in haskell, and many more).
> --->  I am looking for something more hands-on and 'fun' for HS
> students. may i say the buzzword 'project based', or maybe better
> 'problem based' for our case.
> Something that I could teach a little, and then we can solve a bunch of
> problems, and teach a little more, and so on.
>
> It doesn't have to be a Book!!  Just an outline of a course someone did
> with associated bunch of problems would be awesome. We have 18 weeks in
> a semester. My thought right now (if I don't find anything) is to relyon
> Euler project early problems. These are often clean and simple in
> Haskell.  Or otherwise some CSES problems (which we've done in Java).
>
> Ok, long enough email.
>
> If you have material and can share here, great!
> If you have material and want to reach out privately, please do
> ([hidden email] <mailto:[hidden email]>).
> If you have a good pointer, that would be appreciated.
>
> Thanks in advance for any help!
>     Zachi
> (Dr. Zachi Baharav, HS teacher  (after 20 years in Industry and academia))
>
>
>
>
>
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

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

Andrew Butterfield-2
In reply to this post by Zachi Baharav
Dear all

> On 11 Dec 2020, at 00:07, Henning Thielemann <[hidden email]> wrote:

.... stuff elided

> So recursion looks to me as funtional programming's GOTO, and if it is tail recursive, it actually is one.

Yes, but it's "GOTO considered beneficial"  ;-)

Thanks to Zachi for asking the original question - I've already seen lots more ideas for me to chase up for my course!

Regards, and Happy Holidays,

  Andrew

> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
--------------------------------------------------------------------
Andrew Butterfield     Tel: +353-1-896-2517     Fax: +353-1-677-2204
Lero@TCD, Head of Software Foundations & Verification Research Group
School of Computer Science and Statistics,
Room G.39, O'Reilly Institute, Trinity College, University of Dublin
                         http://www.scss.tcd.ie/Andrew.Butterfield/
--------------------------------------------------------------------

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

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

Speykious
In reply to this post by Zachi Baharav
OK, I realized that I forgot to reply all...
Really sorry about that! Here's a duplicate of my mail for everyone to see.

Hello,

I am a CS student in second year of bachelor's and a big fan of Haskell. Currently in our courses, we learn about functional programming with OCaml, which I believe to be a poor choice as an introduction in the paradigm. But I learned about Haskell before all that mainly thanks to the internet, and particularly YouTube which has some great audio-visual content for Haskell.

Thus, I have several ideas for projects that your students could do, inspired and taken from various places, mainly the internet:

- implement a JSON parser (from scratch, without Parsec). Indeed, parsing is a very functional process, and Haskell makes it way easier to do than other languages as a consequence, especially with the use of typeclasses and operators from the standard library.
The idea could be applied for other data formats such as YAML, TOML, or even XML, although some are more difficult to implement than others.

- generate .wav files, a.k.a make music from scratch. There is a great YouTube channel called Tsoding, and it has some truly amazing content. This is where I got this idea from.
By the way, he also implemented a JSON parser from scratch in Haskell and made a video about it.

- create a library for ANSI color codes in the terminal, functions like green, red and bold to color strings. This is how I started practicing Haskell, and it gave me a good grasp at functional concepts such as currying and function composition.

- Solve problems from the Advent of Code 2020 in Haskell. Some of them, and I'm thinking particularly about day 7, seem to be very recursive problems; but overall, I believe it will also help them to get their mind around using maps, filters and folds instead of imperative loops. I also remember seeing that somewhere, some professors already literally made their exam question be something like "solve day X of the Advent of Code 20XX", which I found to be hilarious and amazing!

- Besides the Advent of Code, there are also online challenging sites for general coding, like Codewars.

I hope that my ideas have been useful and/or interesting. If I have any other ones, I'll post them here.
As a last note, I'd like to share a YouTube channel: Philipp Hagenlocher, who created a series entitles Haskell for Imperative Programmers, and which aims at, well, explain Haskell for Imperative Programmers, as Haskell being purely functional is a very powerful feature but difficult to grasp for people who come from imperative programming languages (like I do).

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

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

Chris Smith-31
In reply to this post by Zachi Baharav
Hi Zachi,

This is a really interesting project, and related to things I'm working on.  Regardless of whether you take my advice, I'm very interested in hearing how it goes.  Teaching Haskell at younger ages is something I care deeply about.

Over the last nine years or so, I have built a web-based platform called CodeWorld, which you might find useful for your class.  CodeWorld provides two things:

- A way to get your students started quickly and easily in class, without waiting for them to install GHC, Cabal/Stack, etc.
- An easy graphics and UI library with a purely functional style.  This architecture, known by various crowds as "functional MVC", "the universe model" (by the Racket community), "Glossy programs" (by Haskellers), or most of "the Elm architecture" (by the Elm community) is a real gem of functional programming education, and lets your students experience declarative programming and build cooI things easily, without needing to get bogged down in stuff like I/O, recursion, etc.

Putting these things together, I typically get 13-year-olds to write their first working Haskell program and make creative choices about it on the first day of school.

There are two ways to use CodeWorld:

1. https://code.world/haskell is basically Haskell in the web browser, along with the purely functional graphics library mentioned above.  A large number of widely used Haskell packages are available for import, as well.

2. https://code.world is the same thing, but also using an educational dialect of the language that I have found to be much easier for absolute beginners to pick up and work with.  The main changes from standard Haskell are that type classes are completely removed, all library functions are uncurried, the compiler rejects certain error-prone things students do by accident, and many of the error messages are rewritten.  The drawback, though, is that while the code your students would write here is compiled by GHC(JS), it's not "ordinary" Haskell, so your students wouldn't be able to rely on other random learning resources from the Internet or use most existing third-party libraries.  In their place, there is a somewhat involved online Guide that introduces the language and standard library, and both I myself and LSU's Gordon Cain Center have produced different learning materials for ages ~ 13-17 years, tailored for this educational dialect.  Happy to chat more or get you in touch with people from the LSU team, if you are interested in going that route.

If CodeWorld isn't right for your class and you would prefer more traditional Haskell tooling, I still recommend adopting the same graphics architecture, and one way to do so is to use Gloss, a very well-known Haskell implementation that's been around for ages and is widely used for education, graphics demos, and more.

Let me know, and good luck!

Chris Smith

On Thu, Dec 10, 2020 at 4:59 PM Zachi Baharav <[hidden email]> wrote:
Dear mighty Haskell list,

I am a high-school teacher in the US (California, Palo Alto). We have an advanced CS course that students can take after completing the AP-CS-A (in Java). This is usually Juniors and Seniors, after at least 2 or 3 courses of coding (Python+Java). Traditionally, I've done a potpourri of subjects, mostly search algorithms as applied to 'games'. Of course a little bit of data-structure comes in, and each year we did some 'other' interesting subject (like halftoning, barcodes, and so on) and investigated and implemented algorithms there.

THIS year, for the second half, I would like us to do Functional-Programming. From what I have seen, my students over the years tend to write more and more convoluted codes, electing first to search on stackOverFlow for some similar pattern, rather than think and find a concise and clean solution. I think FP would supply them with a new way of thinking, which will help with whatever they will write later on.

I've been coding with Haskell for about 7 years, so feel ok leading the class.

The question: I have many books on Haskell (i think 'all', but who knows.  Haskell, Real world Haskell, Learn you a haskell for great good, programming in haskell, and many more). 
--->  I am looking for something more hands-on and 'fun' for HS students. may i say the buzzword 'project based', or maybe better 'problem based' for our case.
Something that I could teach a little, and then we can solve a bunch of problems, and teach a little more, and so on.

It doesn't have to be a Book!!  Just an outline of a course someone did with associated bunch of problems would be awesome. We have 18 weeks in a semester. My thought right now (if I don't find anything) is to relyon Euler project early problems. These are often clean and simple in Haskell.  Or otherwise some CSES problems (which we've done in Java).

Ok, long enough email.

If you have material and can share here, great! 
If you have material and want to reach out privately, please do ([hidden email]).
If you have a good pointer, that would be appreciated.

Thanks in advance for any help!
   Zachi
(Dr. Zachi Baharav, HS teacher  (after 20 years in Industry and academia))







_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

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

Speykious
Speaking about playground websites, I also know about https://repl.it/ which allows to write code and run it for several languages, including Haskell. The great thing about this is that people can team up and see each other modify the code in real time, which is perfect for student projects.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

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

David Feuer
In reply to this post by Albert Y. C. Lai
On Thu, Dec 10, 2020, 6:58 PM Albert Y. C. Lai <[hidden email]> wrote:
I think that the 99 Haskell Problems are an easy source of short exercises.

I think the 99 Haskell problems are mostly a *terrible* source of short exercises. The problem is that they're exercises translated from Prolog and Lisp. Some of them need substantial "translation" to even make sense in a typed language. Others are problems designed to highlight features Haskell doesn't have. Anyone looking to that list for inspiration will have to do a *lot* of weeding to get something suitable for beginning students, and will probably miss out on the opportunity to use more appropriate problems.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

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

Francesco Ariis
Il 11 dicembre 2020 alle 08:21 David Feuer ha scritto:
> I think the 99 Haskell problems are mostly a *terrible* source of short
> exercises. The problem is that they're exercises translated from Prolog and
> Lisp. Some of them need substantial "translation" to even make sense in a
> typed language. Others are problems designed to highlight features Haskell
> doesn't have. Anyone looking to that list for inspiration will have to do a
> *lot* of weeding to get something suitable for beginning students, and will
> probably miss out on the opportunity to use more appropriate problems.

Big smile.  When I started out, 99 Haskell problems were so useful to me;
easy enough to tackle them myself, lots of idiomatic solutions on the wiki
to check how things were properly done.

Some of them required additional bending to fit the problem into Haskell
way of doing things; only now I realise this was not a clever choice by
the editor but a consequence of the translation.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

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

Johannes Waldmann-2
In reply to this post by Zachi Baharav
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-graphics/collection/src/Let
- 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 ..
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

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

Richard O'Keefe
In reply to this post by Albert Y. C. Lai
You can find "ML for the Working Programmer" on-line at
Supposedly this is legal.

On Fri, 11 Dec 2020 at 13:00, Albert Y. C. Lai <[hidden email]> wrote:
I think that the 99 Haskell Problems are an easy source of short exercises.

https://wiki.haskell.org/H-99:_Ninety-Nine_Haskell_Problems

For longer, well-motivated problems, I think of the long-running
examples in textbooks, for example the Countdown chapter in Hutton's
Programming in Haskell.

If you can find/borrow Lawrence Paulson's ML for The Working Programmer,
it has a list of suggested projects near the end.  Don't worry about how
that book is on ML rather than Haskell, most of its exercises and
projects are good for Haskell too.  In fact, enjoy this sentence from
the book: "This sort of thing is easier in Haskell". :)

And now a dark turn---every silver lining has tarnish.

FP does not change people from writing convoluted borrowed code to
original simple code.  I saw this in my students, their only difference
from your dis they are in university.  Everything you said about having
gone through Python and Java, fishing for answers on Stackoverflow, and
making a mess, is just as true of my students.  And to think that
they're university students, yes.

In fact, it may be even worse, now that recursion is compulsory.  People
distrust recursion, they will think up all kinds of crazy schemes to
micromanage code execution, rather than just letting recursion do its job.

In fact, even worse when the language is Haskell instead of SML and
OCaml, because of "how do I print debugging output?"


On 2020-12-10 4:55 p.m., Zachi Baharav wrote:
> Dear mighty Haskell list,
>
> I am a high-school teacher in the US (California, Palo Alto). We have an
> advanced CS course that students can take after completing the AP-CS-A
> (in Java). This is usually Juniors and Seniors, after at least 2 or 3
> courses of coding (Python+Java). Traditionally, I've done a potpourri of
> subjects, mostly search algorithms as applied to 'games'. Of course a
> little bit of data-structure comes in, and each year we did some 'other'
> interesting subject (like halftoning, barcodes, and so on) and
> investigated and implemented algorithms there.
>
> THIS year, for the second half, I would like us to do
> Functional-Programming. From what I have seen, my students over the
> years tend to write more and more convoluted codes, electing first to
> search on stackOverFlow for some similar pattern, rather than think and
> find a concise and clean solution. I think FP would supply them with a
> new way of thinking, which will help with whatever they will write later on.
>
> I've been coding with Haskell for about 7 years, so feel ok leading the
> class.
>
> The question: I have many books on Haskell (i think 'all', but who
> knows.  Haskell, Real world Haskell, Learn you a haskell for great good,
> programming in haskell, and many more).
> --->  I am looking for something more hands-on and 'fun' for HS
> students. may i say the buzzword 'project based', or maybe better
> 'problem based' for our case.
> Something that I could teach a little, and then we can solve a bunch of
> problems, and teach a little more, and so on.
>
> It doesn't have to be a Book!!  Just an outline of a course someone did
> with associated bunch of problems would be awesome. We have 18 weeks in
> a semester. My thought right now (if I don't find anything) is to relyon
> Euler project early problems. These are often clean and simple in
> Haskell.  Or otherwise some CSES problems (which we've done in Java).
>
> Ok, long enough email.
>
> If you have material and can share here, great!
> If you have material and want to reach out privately, please do
> ([hidden email] <mailto:[hidden email]>).
> If you have a good pointer, that would be appreciated.
>
> Thanks in advance for any help!
>     Zachi
> (Dr. Zachi Baharav, HS teacher  (after 20 years in Industry and academia))
>
>
>
>
>
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

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

Joachim Breitner-2
In reply to this post by Zachi Baharav
Hi,

https://haskell-via-sokoban.nomeata.de/, which uses CodeWorld, starts
from zero, teaches programming not libraries, and in the end lets them
build a game might be good.

It’s a bit steep in some cases (e.g. recursion), but could well form
the basis of a course with more explanation.

It was part of https://www.cis.upenn.edu/~cis194/fall16/, the other
CIS194 iterations are also worth looking at.

Cheers,
Joachim


--
Joachim Breitner
  [hidden email]
  http://www.joachim-breitner.de/


_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

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

Zachi Baharav
Thanks everyone for the insights and suggestions!!
I will now have the 2-weeks of XMas break to come up with something.

Two notes:
1. Problem set: We might use these https://cses.fi/problemset/  . We did many in Java. I think doing the same ones in a different form will be educating.

2. Remote-learning: I don't want to open a whole-new can of worms, and this is not the list for this, BUT, remote learning certainly influenced my CS classes as well (to my surprise!).   Keep in mind I am talking high school, where in normal-years they will have about half of our time together to work. I would then go around, help people, see where they are, they can ask me questions. 'Lab' kind of thing. We do not do that now (less contact time to start with), and moreover, working-remotely for high-schoolers is remotely-working. So I will need to consider this as well for my planning.

Thanks again, and happy holidays!
  Zachi 


On Wed, Dec 16, 2020 at 7:28 AM Joachim Breitner <[hidden email]> wrote:
Hi,

https://haskell-via-sokoban.nomeata.de/, which uses CodeWorld, starts
from zero, teaches programming not libraries, and in the end lets them
build a game might be good.

It’s a bit steep in some cases (e.g. recursion), but could well form
the basis of a course with more explanation.

It was part of https://www.cis.upenn.edu/~cis194/fall16/, the other
CIS194 iterations are also worth looking at.

Cheers,
Joachim


--
Joachim Breitner
  [hidden email]
  http://www.joachim-breitner.de/


_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

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

Haskell - Haskell-Cafe mailing list
I hope this will remove duplicate recipients, not entirely sure how to properly reply on this mailing list (and mailing lists period really) yet, sorry if I screwed something up...

God how I would have loved to have a Haskell (or any programming) course in high school 😅

Further remarks inline, and best of luck to you and your students, have fun

On December 16, 2020 8:59:44 p.m. GMT+01:00, Zachi Baharav <[hidden email]> wrote:
>Thanks everyone for the insights and suggestions!!
>I will now have the 2-weeks of XMas break to come up with something.
>
>Two notes:
>1. Problem set: We might use these https://cses.fi/problemset/  . We did
>many in Java. I think doing the same ones in a different form will be
>educating.
That's actually a great idea, I'll remember that when I start teaching one day 😅😅
>
>2. Remote-learning: I don't want to open a whole-new can of worms, and this
>is not the list for this, BUT, remote learning certainly influenced my CS
>classes as well (to my surprise!).   Keep in mind I am talking high school,
>where in normal-years they will have about half of our time together to
>work. I would then go around, help people, see where they are, they can ask
>me questions. 'Lab' kind of thing. We do not do that now (less contact time
>to start with), and moreover, working-remotely for high-schoolers is
>remotely-working. So I will need to consider this as well for my planning.
You might want to consider, maybe, Repl.it for its collaborative online coding facilities which might come in handy in this context. For community stuff, of course Discord or Zulip are in my opinion great choices for questions and answers, and Discord has great screen sharing and voice chat as well, idk about Zulip enough on that one though 😅 but both require time and experience to set up properly and securely; your students might be able to help you with that for Discord if you don't have experience with it yourself.

>
>Thanks again, and happy holidays!
>  Zachi
>
>
>On Wed, Dec 16, 2020 at 7:28 AM Joachim Breitner <[hidden email]>
>wrote:
>
>> Hi,
>>
>> https://haskell-via-sokoban.nomeata.de/, which uses CodeWorld, starts
>> from zero, teaches programming not libraries, and in the end lets them
>> build a game might be good.
>>
>> It’s a bit steep in some cases (e.g. recursion), but could well form
>> the basis of a course with more explanation.
>>
>> It was part of https://www.cis.upenn.edu/~cis194/fall16/, the other
>> CIS194 iterations are also worth looking at.
>>
>> Cheers,
>> Joachim
>>
>>
>> --
>> Joachim Breitner
>>   [hidden email]
>>   http://www.joachim-breitner.de/
>>
>>
>> _______________________________________________
>> Haskell-Cafe mailing list
>> To (un)subscribe, modify options or view archives go to:
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>> Only members subscribed via the mailman list are allowed to post.
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.