Want this course?
Day 1 Conclusion
Let's wrap up our first day at the bakery and take a look at what we've accomplished.
Well, that's the end of the first lesson. Let's take a look at the cake recipe again:
Cake 2 cups flour 2 eggs 1 cup milk 1 cup sugar mix all ingredients bake in pan for 25 minutes let cool
Here is our first way to make a cake:
(grab :cup) (scoop :flour) (add-to-bowl) (scoop :flour) (add-to-bowl) (release) (grab :egg) (squeeze) (add-to-bowl) (grab :egg) (squeeze) (add-to-bowl) (grab :cup) (scoop :milk) (add-to-bowl) (scoop :sugar) (add-to-bowl) (release) (mix) (pour-into-pan) (bake-pan 25) (cool-pan)
If you squint, you can kind of see the recipe in the code. However, here's our last version:
(add :egg 2) (add :flour 2) (add :milk 1) (add :sugar 1) (mix) (pour-into-pan) (bake-pan 25) (cool-pan)
It's much closer. In fact, we've been moving our code closer to this form with each step. And we'll be doing that more and more in the next lessons.
Code is available: lispcast/introduction-to-clojure
Code for this particular lesson is available at the
You can checkout the code in your local repo with this command:
$CMD git clone https://github.com/lispcast/introduction-to-clojure.git $CMD cd introduction-to-clojure $CMD git checkout -f 1.17