This meetup, we really did talk about folds and also went over the Caesar ciphers. You can find two examples of Caesar cipher code in this repo. One of them removes all the spaces and maps toLower
over the string input before encoding it (and it's also the first one I wrote, so it's less tidy) -- but it does have a main
executable so you can use it "interactively" if you like. However, that first input had better be something my hacky use of read
can parse into an Int
argument or else you'll get an exception. The other problem with this version is that it doesn't have an unCaesar
function.
You can build either of them as Stack projects. It would be easiest if you build it with stack new <project name> simple
. Put the functions and main
executable into the file called Main.hs and also ensure that you name the module to match the file name. I think next time we should probably talk a little bit about what Stack is and why and when to use it (and when it's not necessary)
There were also a lot of questions about folds and in particular about how folds evaluate and how foldr
can operate on infinite lists. I ended up turning that into a blog post here (if you read it and have questions or corrections, don't hesitate to contact me).
We then got into a discussion -- probably more of a monologue from me, sorry! -- about typeclasses and monoids and functors. We'll be covering all those in more detail later, so don't worry if you missed it.
Finally we talked about what the next project we wanted to build is, and it was suggested that we build a version of the chopsticks hand game, such that you could play against the computer. I'm going to be thinking about that for next time. Since I'm not sure yet how exactly we'll write that game, I'm going to just say for now that we'll talk about the things that are useful for writing the game, rather than planning specific topics beforehand.