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]]
⇒ [3, 7]Try it

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.

JamoFamilyWhat it doesRemember it by
ㄱmaptransform each unitone bend: each item goes in across the top and comes out below, changed
ㄴselectfilter: keep some itemsa corner that catches: the items that pass drop in and stay
ㄷreducecollapse a dimension: totals, counts, meansa bracket ⊏ closing around a run: many values gathered into one
ㄹscanrunning (cumulative) aggregatesa path that folds back at every step: the running total keeps each step
ㅁshapereshape: pad, trim, merge, split, tile, transposea closed box: the array's outline, which shape redraws
ㅂliftbroadcast: align two shapes, then apply Fㅁ, the box, with its sides drawn up taller: a shape stretched to fit another
ㅅordersort, reverse, gradea comparison sign stood upright: sorting compares two at a time
ㅇrefpick a positiona ring drawn around one spot: reach in and pick that position
ㅈcombinejoin, zip or concatenate two datasetstwo legs under one bar: two datasets joined into one
ㅊgroupsplit into a partitionㅈ with a stroke added: the inverse of combine, one dataset split into many
ㅌgeneratecreate arrays: ones, zeros, rangesㄷ with a stroke added: the inverse of reduce, a description expanded into an array
ㅎlocalaggregate 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]
⇒ 8Try it
랃 [3, 1, 4]
⇒ [3, 4, 8]Try it
핟 2 [3, 1, 4]
⇒ [`none, 4, 5]Try it

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.

JamoFlowWhere it worksRemember it by
ㅣelemeach elementone upright stroke, alone: one element at a time
ㅡwholethe whole array, flattenedone flat line across everything: the whole array, laid flat
ㅏtrailingthe last axis (each row)the tick points right, to the last axis: along each row
ㅓleadingthe first axis (each column)the tick points left, back to the first axis: down each column
ㅗouterevery pair (outer)the tick points up: the result grows, every pair makes a table
ㅜinnercorresponding pairs (inner)the tick points down, against ㅗ: only the pairs at the same position
ㅐkeyedby key: the keys come firsta rung joins the two rails: key and data, both in hand
ㅔgroupedwithin each groupthe rails stand apart: the data is already split into groups
ㅢrankedper 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]]
⇒ [4, 6]Try it
듣 [[1, 2], [3, 4]]
⇒ 10Try it

덛 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]
⇒ [[11, 21], [12, 22]]Try it
굳 [1, 2] [10, 20]
⇒ [11, 22]Try it

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.

JamoFinalMeaningRemember it by
ㄱgreatertoward greater (max)its bar on top, like ⌈ (round up): toward the greater
ㄴlessertoward lesser (min)its bar at the bottom, like ⌊ (round down): toward the lesser
ㄷadditiveadditive (sum)one bracket: values set side by side and added up
ㄹmultiplicativemultiplicative (product)ㄷ folded back on itself: a product is a sum, repeated
ㅁcardinalitycardinality (count, exactly N)a closed box: count exactly what is inside
ㅅflipfliptwo strokes mirroring each other: the natural opposite
ㅇbalancedbalanced (mean, normalize)a circle, even all round: the balanced middle
ㅈindexindex (positions)a pointer: positions, not values
ㅍabsenceabsence-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:

SyllableFinalOn [3, 1, 4]
닥greater4, the max
단lesser1, the min
닫additive8, the sum
달multiplicative12, the product
담cardinality3, the count
당balanced2.6666666666666665, the mean
달 [3, 1, 4]
⇒ 12Try it

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]
⇒ [5, 4]Try it

In order, lesser sorts toward lesser, ascending:

산 [3, 1, 4]
⇒ [1, 3, 4]Try it

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]
⇒ [0, 2]Try it

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]
⇒ 8Try it

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]
⇒ 314Try it

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]
⇒ [3, 4]Try it

A bare form alone, with no function, is a type error: it is waiting for its operand.

다 [1, 2]
⇒ !type: 다 is open: it needs a function operand glued on its left (§3.4, D14)Try it

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.

  1. It means nothing. A single element cannot be reduced, so reduce has no ㅣ form, and neither does scan. These cells are illegal.
  2. 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.
  3. 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 are unresolved.

Here is how many syllables each family has on each flow. The ㅢ column is empty: the whole row is deferred.

Familyㅣㅡㅏㅓㅗㅜㅐㅔ
map ㄱ81010105511
select ㄴ90330021
reduce ㄷ07770177
scan ㄹ07770077
shape ㅁ06660030
lift ㅂ00550030
order ㅅ15550032
ref ㅇ01110011
combine ㅈ45001070
group ㅊ10050000
generate ㅌ06110000
local ㅎ00770077

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]
⇒ !unminted: 닾: D42: reduce + ㅍ is displaced; sum the present elements with 닫 (닢 x)Try it

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]]
⇒ [[3, 4], [1, 2]]Try it

Change the flow to ㅏ, and 삿 reverses within each row instead:

삿 [[1, 2], [3, 4]]
⇒ [[2, 1], [4, 3]]Try it

A few steps make this routine:

  1. 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.
  2. Find the flow from the vowel. It tells you which part of the data the operation sees.
  3. Find the final, if there is one. With no final, look for the function glued on the left.
  4. 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]
⇒ !illegal: 야 is not on the operator lattice: one of its parts has no meaning (§3, D39)Try it