The lattice
Every Garo operator is one Hangul syllable, and every syllable is built from three parts. This page lists all three parts, says what each one means, and shows how to read a syllable you have never seen.
Three parts
A Hangul syllable is written as a block of letters, called jamo. Garo reads three of them:
- the family, the first consonant: what kind of operation;
- the flow, the vowel: where in the data it works;
- the final, the last consonant: how, the variant of the operation.
Take 닫 (pronounced dat). Its parts are ㄷ, ㅏ and ㄷ.
닫 = ㄷ + ㅏ + ㄷ
reduce trailing additive
collapse along each row, by summing
닫 [[1, 2], [3, 4]]A syllable's meaning is exactly its three parts, and nothing else. A syllable that happens to be a Korean word means nothing special: 닫 is reduce, trailing, additive, not the verb it spells. The spec calls the flow the traversal and the final the quality; this site says flow and final.
The three parts make a grid of possibilities, the lattice. Each part varies on its own. So once you know the 30 parts, you can read any syllable, and change one part to get a related operation.
The twelve families
The first consonant names the family. The last column gives a way to remember each one by its shape; each shape is read one way only. Each family links to its section of the operator reference, which lists every syllable in it.
| Jamo | Family | What it does | Remember it by |
|---|---|---|---|
| ㄱ | map | transform each unit | one bend: each item goes in across the top and comes out below, changed |
| ㄴ | select | filter: keep some items | a corner that catches: the items that pass drop in and stay |
| ㄷ | reduce | collapse a dimension: totals, counts, means | a bracket ⊏ closing around a run: many values gathered into one |
| ㄹ | scan | running (cumulative) aggregates | a path that folds back at every step: the running total keeps each step |
| ㅁ | shape | reshape: pad, trim, merge, split, tile, transpose | a closed box: the array's outline, which shape redraws |
| ㅂ | lift | broadcast: align two shapes, then apply F | ㅁ, the box, with its sides drawn up taller: a shape stretched to fit another |
| ㅅ | order | sort, reverse, grade | a comparison sign stood upright: sorting compares two at a time |
| ㅇ | ref | pick a position | a ring drawn around one spot: reach in and pick that position |
| ㅈ | combine | join, zip or concatenate two datasets | two legs under one bar: two datasets joined into one |
| ㅊ | group | split into a partition | ㅈ with a stroke added: the inverse of combine, one dataset split into many |
| ㅌ | generate | create arrays: ones, zeros, ranges | ㄷ with a stroke added: the inverse of reduce, a description expanded into an array |
| ㅎ | local | aggregate over a sliding window | ㅇ, one position, under a lid: the window around each position |
Change only the family, and the same flow and final mean the analogous thing in the new family. With ㅏ and ㄷ, reduce gives the total, scan the running total, and local the total of each window:
닫 [3, 1, 4]랃 [3, 1, 4]핟 2 [3, 1, 4]The first window of 2 is not full yet, so its total is absent.
The nine flows
The vowel says where the operation applies: to each element, to the whole array, along an axis, to pairs, or by key.
| Jamo | Flow | Where it works | Remember it by |
|---|---|---|---|
| ㅣ | elem | each element | one upright stroke, alone: one element at a time |
| ㅡ | whole | the whole array, flattened | one flat line across everything: the whole array, laid flat |
| ㅏ | trailing | the last axis (each row) | the tick points right, to the last axis: along each row |
| ㅓ | leading | the first axis (each column) | the tick points left, back to the first axis: down each column |
| ㅗ | outer | every pair (outer) | the tick points up: the result grows, every pair makes a table |
| ㅜ | inner | corresponding pairs (inner) | the tick points down, against ㅗ: only the pairs at the same position |
| ㅐ | keyed | by key: the keys come first | a rung joins the two rails: key and data, both in hand |
| ㅔ | grouped | within each group | the rails stand apart: the data is already split into groups |
| ㅢ | ranked | per rank (not available yet) | one stroke layered over another: nested levels, by rank |
The flows are remembered by direction and structure only: which way the tick points, and whether the strokes are joined. Read them by what the glyph looks like (ㅔ as a key, say), and each could mean almost anything.
Change only the flow, and the same sum works somewhere else:
덛 [[1, 2], [3, 4]]듣 [[1, 2], [3, 4]]덛 sums each column, along the first axis. 듣 sums the whole array.
The flows ㅗ and ㅜ take two inputs. 곧 adds every pair from two vectors, which makes a table, and 굳 adds the pairs at the same position:
곧 [1, 2] [10, 20]굳 [1, 2] [10, 20]The ranked flow ㅢ is set aside until a later design settles how ranks are named. Every ㅢ syllable is a deferred error today.
The nine finals
The final consonant picks the variant. A final names a direction or a quality, and each family reads it in its own way.
| Jamo | Final | Meaning | Remember it by |
|---|---|---|---|
| ㄱ | greater | toward greater (max) | its bar on top, like ⌈ (round up): toward the greater |
| ㄴ | lesser | toward lesser (min) | its bar at the bottom, like ⌊ (round down): toward the lesser |
| ㄷ | additive | additive (sum) | one bracket: values set side by side and added up |
| ㄹ | multiplicative | multiplicative (product) | ㄷ folded back on itself: a product is a sum, repeated |
| ㅁ | cardinality | cardinality (count, exactly N) | a closed box: count exactly what is inside |
| ㅅ | flip | flip | two strokes mirroring each other: the natural opposite |
| ㅇ | balanced | balanced (mean, normalize) | a circle, even all round: the balanced middle |
| ㅈ | index | index (positions) | a pointer: positions, not values |
| ㅍ | absence | absence-aware (the present items) | a sieve: the absent fall through, the present stay |
Read ㄱ and ㄴ as rounding, not as lids. ㄱ is ⌈, rounding up: its forms push toward, keep or lead with the greater. A bar on top can look like a ceiling that holds values down, and that reading gets every ㄱ form backwards.
In reduce, the finals are the familiar aggregates:
| Syllable | Final | On [3, 1, 4] |
|---|---|---|
| 닥 | greater | 4, the max |
| 단 | lesser | 1, the min |
| 닫 | additive | 8, the sum |
| 달 | multiplicative | 12, the product |
| 담 | cardinality | 3, the count |
| 당 | balanced | 2.6666666666666665, the mean |
달 [3, 1, 4]Other families read the same final as their own version of the idea. Greater in reduce is the max. In select it keeps items greater than a parameter:
닉 3 [5, 1, 2, 4]In order, lesser sorts toward lesser, ascending:
산 [3, 1, 4]Flip negates numbers in map, reverses in order and transposes in shape. Index gives positions: 닞 gives the positions of the true items.
닞 [true, false, true]Only these nine consonants are finals. Hangul has others, such as ㄲ or the double finals ㄺ and ㄻ. A syllable that uses one is not on the lattice.
The bare form
A syllable with no final is the bare form. It has no built-in variant, so it takes a function instead: the function goes glued on its left, and it does the work. The bare form 다 is "reduce along each row, by F":
+다 [3, 1, 4]With +, that is just 닫. Where a final exists for the function, the bare form and the final are the same operation. The bare form earns its place with a function that has no final, such as a block:
{(x × 10) + y}다 [3, 1, 4]Reduce folds from the left: (3 × 10 + 1) × 10 + 4.
The same goes for every family that has a bare form. F기 maps F over each element, F니 keeps the items where F is true, and F사 sorts by the comparison F:
{x > 2}니 [3, 1, 4]A bare form alone, with no function, is a type error: it is waiting for its operand.
다 [1, 2]Lift ㅂ has no bare form, since its final is the alignment policy and cannot be left out. Its policy forms take a function too: +박 aligns two arrays, then adds. The functions tutorial covers function operands in depth.
Which combinations exist
Twelve families, nine flows, and nine finals plus the bare form make 1,080 possible syllables. Garo uses 258 of them today, 34 of them bare forms. Most of the grid is empty, and on purpose.
A combination exists only when it has one clear meaning. There are three reasons a cell stays empty.
- It means nothing. A single element cannot be reduced, so reduce has no ㅣ form, and neither does scan. These cells are
illegal. - Another syllable already does it. A reverse scan would be 랏, but it is written by reversing, scanning and reversing back, so 랏 is not minted. Reduce with ㅍ, "sum of the present values", is written 닫 (닢 x), so 닾 is not minted. Garo keeps one way to say each thing. These cells are
unminted. - It could exist, but has not earned its place. Some cells wait until a real use appears, and are also
unminted. A few wait on an open design question, and areunresolved.
Here is how many syllables each family has on each flow. The ㅢ column is empty: the whole row is deferred.
| Family | ㅣ | ㅡ | ㅏ | ㅓ | ㅗ | ㅜ | ㅐ | ㅔ |
|---|---|---|---|---|---|---|---|---|
| map ㄱ | 8 | 10 | 10 | 10 | 5 | 5 | 1 | 1 |
| select ㄴ | 9 | 0 | 3 | 3 | 0 | 0 | 2 | 1 |
| reduce ㄷ | 0 | 7 | 7 | 7 | 0 | 1 | 7 | 7 |
| scan ㄹ | 0 | 7 | 7 | 7 | 0 | 0 | 7 | 7 |
| shape ㅁ | 0 | 6 | 6 | 6 | 0 | 0 | 3 | 0 |
| lift ㅂ | 0 | 0 | 5 | 5 | 0 | 0 | 3 | 0 |
| order ㅅ | 1 | 5 | 5 | 5 | 0 | 0 | 3 | 2 |
| ref ㅇ | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 1 |
| combine ㅈ | 4 | 5 | 0 | 0 | 1 | 0 | 7 | 0 |
| group ㅊ | 1 | 0 | 0 | 5 | 0 | 0 | 0 | 0 |
| generate ㅌ | 0 | 6 | 1 | 1 | 0 | 0 | 0 | 0 |
| local ㅎ | 0 | 0 | 7 | 7 | 0 | 0 | 7 | 7 |
Some patterns stand out:
- Map works almost everywhere: "apply this at that level" makes sense at every level.
- Reduce, scan and local have the same seven variants on each axis, key or group flow they accept: the bare form and six aggregates (max, min, sum, product, count, mean).
- Combine works on whole tables, by key, or by position, but not along one axis.
- ㅜ is rare. Its one reduce syllable, 둗, is the inner product, NumPy's
@.
Asking for an empty cell gives an error that says why. The errors page lists the four kinds.
닾 [1, `none, 3]Reading an unknown syllable
To read a syllable you have not met, split it into its three parts and read each one.
Take 섯. Its parts are ㅅ, ㅓ and ㅅ: order, leading, flip. Order with flip is reverse. The leading flow works along the first axis. So 섯 reverses the order of the rows:
섯 [[1, 2], [3, 4]]Change the flow to ㅏ, and 삿 reverses within each row instead:
삿 [[1, 2], [3, 4]]A few steps make this routine:
- Find the family from the first consonant. It tells you what kind of answer to expect: one value per lane for reduce, the same shape for scan or map, fewer items for select.
- Find the flow from the vowel. It tells you which part of the data the operation sees.
- Find the final, if there is one. With no final, look for the function glued on the left.
- Check the parameter. Some finals need one, such as the 3 in
닉 3, the threshold for "greater".
Then check your reading against the operator reference, which glosses each syllable in words. Each syllable has its own entry, such as 섯. The REPL on the home page shows the same gloss for the syllable before the cursor.
If a syllable decodes to nothing, Garo says so. 야's vowel ㅑ is not one of the nine flows:
야 [1]