Loglo Juneteenth release
This release is focused on a new "fill" operator. (This has nothing to do with the old "fill" operator, which has now been renamed to "close"). Try it here.
"fill" consumes 3 arguments from the stack:
- The number of cells below the current one to fill
- The value or code to put in the first one
- The value or code to put in all the rest
In this example we're starting off with a 0, and then filling 7 cells with the number 1.
Here we're filling in with a code block, which gets evaluated for each of the filled in cells.
Here we want to fill in all of the cells with the same thing, a horizontal line.
You'll notice that "fill" leaves the number of rows (8) on the stack, which is convenient in this common case where we want to chain a series of fills.
This example somewhat gratuitously shows off the standard stack operators, using "swap" inside the block to get things in the right order for "rotate", and using "dup" on the block itself to set up the fill.
If you haven't noticed already, it's maybe worth pointing out the blue background which indicates that cells have been filled in from above (vs the yellow background which indicates direct code entry).
For this reduce-like operation, we just want to leave the top cell alone, so we throw a "dup" at it.
I love the versatility of the generic "fill", though wrappers that are specialized for map-like, fold-like, and reduce-like applications would be useful.
This is not compact! But for the drawing domain, it seems like very large lists are unlikely, and we can always provide a more compact, less-visible cons-cell implementation later. And seeing every step of these pipelines, for every element, is awesome. (And very spreadsheety).
Because "fill" takes up so much real estate, I've expanded the grid to take up the entire page and then some, losing the inspector for now. I have ideas on how to replace it.
You'll notice that those friendly exclamation marks are gone. Dropping them was a common piece of feedback from the last release, and I decided they were net-negative. This means that the evaluation rules for cell/word references are a little funkier (for most values, put them directly on the stack, but if it's a block value, immediately evaluate it); but ultimately I like the Smalltalk style of making deferral very explicit (in a lightweight way) by wrapping things in braces, vs the Scheme style of having bare name references leading to first-class function values.
This release also gets rid of the "." operator in favor of postscript's "def".
The "handles" on lines are now there when you mouseover in the grid (since the inspect is gone anyway). This is a pain to screenshot, but it would help you see the direction of the lines and know what's going to happen with "join".