Exercise 1.10 – rewrite add to be variadic

Exercise 1.10 – rewrite add to be variadic

Preview unavailable

You must log in or sign up to view this lesson.

LoginSign up

B01 Introduction to Clojure

Buy nowLearn more

Day 1: Syntax and REPL

  • Read Eval Print Loop (REPL)7
  • Baking cookies - Calling functions1
  • Exercise 1.1 – baking a cake4
  • Defining functions with defn2
  • Exercise 1.2 – several `add-` functions1
  • Refactoring bake-cookies
  • Exercise 1.3 – bake-cake1
  • Conditional branching with cond1
  • Exercise 1.4 – rewrite bake-cake1
  • Exercise 1.5 – scooped?
  • Exercise 1.6 – squeezed?
  • Two-branch conditionals with if and do
  • Exercise 1.7 – add-scooped and add-squeezed
  • Some convenience functions – bowl-for and add
  • Looping a fixed number of times – dotimes
  • Exercise 1.8 – add- functions
  • Exercise 1.9 – rewrite bake-cake
  • Accepting varying numbers of arguments – variadic functions2
  • Exercise 1.10 – rewrite add to be variadic2
  • Exercise 1.11 – rewrite bake-cake
  • Exercise 1.12 – rewrite bake-cookies3
  • Conclusion

Day 2: Data Structures and Editor

  • Introduction to Day 2
  • Moving between locations2
  • Sets and defining variables
  • Exercise 2.1
  • Exercise 2.2
  • Exercise 2.3
  • Maps and looping over collections1
  • Get morning orders
  • Defining local variables with let1
  • Exercise 2.4
  • Functional programming and data-driven programming
  • Nesting loops with doseq1
  • Fetching ingredients2
  • Refactoring fetch-for-cake to use fetch-ingredients
  • Merging maps with merge-with1
  • Exercise 2.7
  • Modifying the values of a map with update-vals
  • Defining inline anonymous functions with fn
  • Exercise 2.8
  • Exercise 2.9
  • Converting a sequence of values to another sequence with map
  • Summing up with reduce
  • Exercise 2.10
  • Exercise 2.11
  • Generating a sequence of numbers with range
  • Concatenating two lists together with cat1
  • Exercise 2.12
  • Day 2 Conclusion

Day3: Data-Driven Programming

  • Introduction to Day 3
  • Exercise 3.11
  • Exercise 3.2
  • Exercise 3.3
  • Exercise 3.4
  • Creating our first recipe in the database
  • Exercise 3.5
  • Exercise 3.6
  • Exercise 3.7
  • Removing unused code
  • Exercise 3.8
  • Exercise 3.9
  • Exercise 3.101
  • Exercise 3.11
  • Exercise 3.122
  • Dispatching to the correct add function
  • Exercise 3.131
  • BONUS Reading and writing EDN
  • BONUS Making code read top to bottom with thread last
  • Conclusion