Sunday, November 10, 2013

Lessons 35-36 - Parametericity

Yesterday we continued with our music project by defining functions taa and titi, so that we can now play an eight and quarter notes as well as a double eight-note. Like

    let ti n = play n 500
    let taa n = play n 1000
    let titi n = s [ti n, ti n]

Today we recapped on that after discussing functions, parameters and other topics. Then she suggested we define yet another function "taa-a", that would be a half-note. And when I asked whether it should have a parameter, she said yes. Did she understand the question?

Anyway, she started typing

   let taaa

Then I asked her what the parameter should be called. First she said "lintu" which means the E string of the violin, but then thought a bit and corrected: we should use n so that we can play any note. The name of the parameter doesn't matter of course, but I think she's starting to grasp the concept of functions and parameters already.

Then she implemented the rest of the function, with some tips from me:

    let taaa n=play n 2000

She remembered the function play. When I asked her which note we should play, she said n. I think that's quite incredible. She almost got the number two-thousand right, too. As in 200.

No comments:

Post a Comment