Monday, July 29, 2019

Learning CL: Day 4

After a brief time away, today I resume my CL journey.

I started out by re-reading my own posts, and suddenly had the urge to start trying things out myself, starting with recreating the "guess the slope of the dashed line" activity. Made me see a few things:
  1. Why there has to be a y = ax on the graph screen, so that the slope (a) that the student inputs gets sent to that value in the graph.
  2. I allowed the slider to be created, and it didn't seem to make any difference. The y = 0.5x graph shows up no matter what, but the y = ax one only shows up once a value for a has been input.
  3. The script gave a warning because I hadn't checked the f(x) math box on the input. Then I was allowed to use the numericValue part. Not checking that makes the input component a text, so the type wouldn't match.
I then did a few more screens with a similar example right away to reinforce all the things:

number("a"): exp2.numericValue  is the script inside in the graph's gearbox. number("a") means that some part of the graph is expecting a number it's calling a, exp2 means it will get that numerical data from a component called exp2, and .numericValue means that the type of data is a number, not text. Worked.

Just not sure why we need to say number at the beginning and then numericValue again at the end. Going back to the CL documentation.  Under "About the CL Language", it says that "every sink expects a specific type, and every source emits a specific type." So in the examples I made with the graphs, "number" is at the beginning to specify that the graph component is a sink that expects a number. Note: Other words you can have at the beginning of a script are string, or boolean. (What about content, isn't that a possibility too? yes - see the table with the heading "Note")

Under "Sources" it says "each component has a different set of sources". So a component can have more than one type of data in it - in the example here two types come from the same component, one being numericValue and another latex.

It seems that the word "number" at the beginning of the script refers to the sink's data type, and the numericValue at the end refers to the source data type.

So what comes after the dot is the type of data we are extracting from a component. There are tables with headings "Sources" listing all the things that could come after the dot, and others with the headings "Sinks" listing all the things that could come before the colon.

I just remembered something Andrew Knauft sent me on twitter:

There's that sink at the beginning before the colon or the equals, and the source at the end after the dot. And the component name in the middle.

Starting (slowly, slowly) to see a structure.

No comments:

Post a Comment