# teaching machines

The summer is drawing to a close. Madeup has come a long way since May! Some big features remain (like support for holes, a persistent server for generating models, and some support for splines), but the core path-walking mechanic is stable and enough hands have touched it and not founding glaring errors that I think I’m ready to share. But first, we need a little more documentation.

Read about the latest changes below, and check out the model of the fortnight!

### Fixlog

• Switches array cardinality function to size instead of length, because I think length has too much spatial connotation (and arrays aren’t necessarily spatial) and because it was conflicting with some parameter names.
• Detects lack of WebGL support.
• Implements support for sibling function calls. Previously, double couldn’t call times because times wasn’t in scope at the time double was defined:
to double x = times 2 x
to times a b = a * b

double‘s definition includes a closure of all the names in scope at the time of its definition, and times was not among those names. In this particular case, one could define times first, but that’s not possible for mutually recursive functions. C fixes this using forward declarations. I fixed this by doing a quick prepass whenever the interpreter encounters a block. If any function definitions are found within the block, the functions’ names are added to the environment right at the block’s start. This implementation may produce some gotchas I haven’t yet encountered.

• Integrates a bunch of Google Test tests on the C++ code.
• Converts all generators to expressions that yield a mesh.
• Adds support for exporting YAML archive of *.mups in local storage.
• Changes archive format to JSON to eliminate dependency on external library.
• Adds support for importing previously exported archives.
• Paper to Blocks and Beyond workshop gets accepted!
• Renames generators to solidifiers.
• Adds a script to overlay preview images over code snippets in documentation, something which is difficult to do in Markdown.
• Adds gentler introduction to the language that isn’t just a language reference.

### Model of the Fortnight

A fellow down the hall invited me to a birthday party for his two-year-old daughter. I had never met her, but I wanted to bring her a gift. The bakery where I like to find these kinds of gifts was closed, so I needed a plan B. That one didn’t turn out either. It wasn’t until plan H that I remembered our 3D printer.

The girl’s name is Hillary. I decided to make her an H-box. My first thought was to make it in Madeup, but a first attempt didn’t go so well. I switched to Blender. There I used the text tool to make an H and then extruded it up, but I couldn’t find an easy way to do an “inner extrude” to make the top lip of the box you see below.

A box for Hillary.

A regular extrude followed by a scale didn’t yield a wall with a constant thickness. At this point, I realized that Madeup was the only way to go. I wrote a very parameterized function to trace out an H and then called it four times to trace out the box:

to h params
...
end

draw bottom outer h
draw top outer h
draw top inner h
draw bottom inner h

Then I called the surface solidifier which hooked all four paths together and the box appeared! Four more calls and I had a lid.

Happy birthday, Hillary!