# Algebraic Data Types in Rust Whiteboard Style! Kung Fu at our Women and Non-Binary hack night

## Humans and Whiteboards First!

As you know, after holding a session on “Learning how to Learn“, we realized that the best thing about SudoRoom is that we love tech but want to use our tech wisely for the forces of good. We decided to switch to a whiteboard first format with no online or hybrid component, just a bunch of human beings face to face during our Rust session at women and non-binary hack night!

It was a little different. Of course we still had laptops nearby, but mostly closed, and a tablet if we absolutely had to look things up online.

What resulted as a cool “jam” as just about everybody was able to grab a whiteboard marker and participate!

We were nervous… would this work? We set up the whiteboards, laid out the tables, and hoped people would be into this freestyle form of symposium!

Mothball and Jade led us through a journey of all their favorite ins and outs of Rust and even the Haskell programming languages.

## Algebraic Data Types: Let’s Start with the Wikipedia Definition!

Jade explained that even though the initial definition of “algebraic data types” in the wikipedia entry has language that’s a little scary if you’re not deep on math or computer science, you can just take apart the definition piece by piece to learn while in a conversation with others.

It feels a lot less intimidating if you can ask people in person, and sketch things out in examples. Plus people who work as engineers could give out examples (like a URL builder out of an enum in Swift), creating a mini-symposium of happy, smart people drawing things out on a big whiteboard for fun!

## Talking about Recursion and Stack Overflow in Whiteboard

It’s nice to step away from the computer screen and discuss recursion and stack overflow. So much less dry than an online class, and these notes I took were outside of the whiteboard fray!

This was also a fun way to get embedded engineers in dialogue right before we went down the rabbit holes journeying from Rust to Haskell (!) But for the others at the women and nonbinary hack night, it’s nice to get down lowwwww and talk about memory in these systems programming languages and even the exotic, weird languages like Haskell.

## Things get Weird in a Good Way

Some parts got pretty wild: I think at this point Mothball was showing us how they used an enum (algebraic data type) in Rust to do math for all natural numbers… I think it was a “Reverse Polish notation” calculator?

Can you imagine using enums to do all your addition of natural numbers?

The notes had us on a discussion of pattern matching in Rust with algebraic data types. When you wield algebraic data types the right way, you can do tons of pattern matching and avoid uncertainty and errors, especially in data structures that handle stuff like network calls! The pattern matching can avoid tons of boilerplate code and if/else statements and totally nasty crashes!

The notes get a little wacky here, but what was nice was that we could take notes and investigate later. https://gist.github.com/CMCDragonkai/9f5f75118dda10131764

And it was so nice! Everyone stood physically closer to each other, and even though a lot of us were noobs at Rust and had never touched Haskell, the advanced people made it easy for senior and advanced beginners to understand. Even people who usually program C were able to join in!

Fun times! We look forward to more in-person meetups. Why meet online when everyone is sick of online meetings? Is it really healthy for people to only socialize and do hacking from a discord channel in their bedroom, when it’s so much nicer to connect with people in person in a crazy hackerspace like sudoroom? we say YEAH!