carpentries-incubator / julia-novice

A lesson exploring the Julia language
https://carpentries-incubator.github.io/julia-novice
Other
15 stars 20 forks source link

Split conditionals and loops #50

Closed psteinb closed 8 months ago

psteinb commented 12 months ago

Teaching Module 06-control-flow is densily packaged with content. To open the material to more novice programmers, I suggest to split it.

With this separation, one could also introduce loops in a more simple minded fashion. For example, if your goal is to optimize the parameters of the trebuchet, maybe storing the params and the distances first in a Vector/Tuple/Dict might make sense. This way, for loops could be introduced in a more shallow fashion a la

  1. I want to make 12 experiments, so let's create a vector with zeros(12) first for the achieved distances
  2. let's loop over the vector and create 12 pairs of shots of the trebuchet
  3. let's check the results by printing the vector
  4. but that is all very clumsy, let's do forward differentiation and conduct an optimisation