Values and types
This page lists every kind of value Garo has, and the rule that decides which operations a value accepts. The syntax page shows how each one is written. Here we look at what each one is.
The base types
A base type is the type of one element: one number, one label, one date. Garo has eight.
| Type | Examples | What it is |
|---|---|---|
| Int | 42, -7 | a whole number of any size |
| Float | 3.5, ∞ | a 64-bit floating-point number |
| Bool | true, false | a truth value, not a number |
| Sym | `east | a label: compared, sorted, grouped, never taken apart |
| Text | "hello" | a piece of text, as one element |
| Date | Date [2026, 11, 27] | a calendar day |
| Duration | Days 30 | a number of days |
| an enum | `s, after declaring Size | a label from a closed set you declare |
Besides these, any element can be absent: `none, a missing value. Absence is covered below.
Int
An Int is a whole number with no size limit. It never overflows.
2 × 4611686018427387904 × 4Float
A Float is a 64-bit floating-point number, the float64 of NumPy. It is written with a digit on both sides of the point. ∞ and -∞ are Floats too. Float arithmetic rounds, as it does everywhere:
0.1 + 0.2Garo has no NaN. An operation with no defined Float result is an error instead, of kind domain:
∞ - ∞Ints and Floats together
Ints and Floats are the only two types that mix. When they meet, the result is a Float. An array with both is an array of Floats:
[1, 2.5]÷ always gives a Float, even when both sides are Ints and the division is exact:
7 ÷ 7A Float never becomes an Int on its own. Comparison is the one place they meet without converting: an Int and a Float are equal when their exact values are equal.
2 = 2.0Bool
A Bool is true or false. It is not a number: there is no 0 or 1 behind it, so a Bool cannot be added or summed. Comparisons give Bools, and 깃 (flip) negates them.
깃 [true, false]To count the trues, select their positions first, then count: 담 닞 mask. The functions tutorial shows more.
Sym
A Sym is an atomic label: a backquote, then a name. Use it for categories, such as regions, statuses or product codes. A Sym can be compared for equality and sorted alphabetically, and nothing else. In NumPy terms it is a categorical value; in SQL, a short code you GROUP BY.
`a < `bTwo Syms cannot be added:
`a + `bText
Text is written in double quotes. A text is one element, however long, so an array of texts is a plain vector. Texts compare and sort by character code. Their sum is their concatenation:
닫 ["ab", "cd"]Text has no arithmetic otherwise. "a" + "b" is a type error: concatenation is 닫, not +. A Sym and a Text are different types, even when they spell the same word. Taking a text apart into characters is not available yet.
Date and Duration
A date is made by the function Date from a year, a month and a day. A span of days is made by Days. There are no date literals, because 2026-11-27 already reads as two subtractions.
(Date [2026, 12, 25]) - Date [2026, 11, 27]A date minus a date is a Duration. A date plus a Duration is a date. Two dates cannot be added. Durations add, scale by an Int, and sum:
닫 [Days 1, Days 2]A date that does not exist is a domain error, not the next valid day:
Date [2026, 2, 30]The mean of dates is a date, and the mean of Durations is a Duration. Both round down to a whole day.
Enums
An enum is a closed set of Syms that you declare at the top of a program. Its order is the order you wrote. The enum's name, used as a function, turns a position into a label:
enum Size = `s | `m | `l
[Size 0, Size 2]An enum's labels sort by declaration order, not alphabetically:
enum Size = `s | `m | `l
산 (Size기 [2, 0, 1])An enum value is equal to the Sym of the same name. Two different enums do not mix. Grouping by an enum gives one group per declared label, in order, including empty ones:
enum Size = `s | `m | `l
첮 (Size기 [2, 2, 0]) [10, 20, 30]The enum's name must start with a capital letter. Its labels must be distinct, and `none cannot be one of them, since it already means absent.
Absence
`none marks a missing element. Any element type can be absent: an array of Ints with a hole is still an array of Ints.
[1, `none] + 10Arithmetic with an absent value gives an absent value, and so does an aggregate over a lane with a hole. Asking for something that is not there, such as a position past the end, also gives `none rather than an error. 닢 skips absent values, and 깊 fills them. The tables and absence tutorial covers the details.
The mean, maximum and minimum of nothing are absent too. The sum of nothing is 0, and the product of nothing is 1:
닫 []Arrays and rank
Every value in Garo is an array. A single number is an array with no axes, called a scalar. A vector has one axis, a matrix has two, and so on. The number of axes is the array's rank.
| Rank | Name | Example |
|---|---|---|
| 0 | scalar | 5 |
| 1 | vector | [1, 2, 3] |
| 2 | matrix | [[1, 2], [3, 4]] |
| 3 | 3-tensor | [[[1]], [[2]]] |
All the elements of an array have one type. Arrays are rectangular: every row of a matrix has the same length. A ragged array is a type error:
[[1, 2], [3]]The shape of an array is its length along each axis. [[1, 2, 3], [4, 5, 6]] has shape 2 by 3. Rank is part of a value's type. Lengths are not: they are data. This difference decides which error you get when two arrays do not fit, as the type rule explains.
A sign between a scalar and an array applies the scalar to every element, as broadcasting does in NumPy:
[[1, 2], [3, 4]] + 10Two arrays of the same shape pair element by element. No other shapes broadcast on their own. To align two different shapes, use the lift family ㅂ, which makes the alignment policy visible: extend, clip, tile or interpolate.
+박 [1, 2] [10][] is an empty array. It has no element type yet, and takes the type of whatever it meets.
Keyed-arm literals
A keyed-arm literal is a block whose arms are key ⇒ result. It is a function: given a value, it takes the arm whose key matches. It is Garo's only way to branch.
enum Size = `s | `m | `l
{ `s ⇒ 5, `m ⇒ 2, `l ⇒ 1 }기 (Size기 [0, 2, 1])The keys come from the value's type:
- an enum's labels;
`trueand`falsefor a Bool;`okand`errfor a Try result;`someand`nonefor any value that may be absent.
The arms must cover every key of that type. If they do not, the literal is a type error:
{ `true ⇒ 0 } falseAn arm whose left side is a lowercase name, such as other or _, is the else arm: it takes every key no other arm names. Open Syms, which have no declared set, always need one:
{ `a ⇒ `z, k ⇒ k } `bMore rules:
- A key may appear only once, and there is at most one else arm.
`some v ⇒ vnames the value the key carries. For a Try result,`ok vnames the result and`err kthe error's kind.- An absent value passes through unchanged, unless there is a
`nonearm. - Every arm's result must have one type. An arm that gives an Int and an arm that gives a Sym do not fit together.
{ `some v ⇒ v × 2, `none ⇒ 0 }기 [1, `none, 3]Try results
?F is Try: it runs F, and turns success or failure into a value. Success is `ok and the result. Failure is `err and the error's kind, as a Sym.
(?{1 ÷ x}) 0(?산) [3, 1, 2]A Try result is consumed with a keyed-arm literal:
{ `ok v ⇒ v, `err k ⇒ 0 }기 ((?{1 ÷ x})기 [1, 0, 4])Try catches errors that depend on the data, which are domain errors. It does not catch mistakes in the program itself, such as a type error. The errors page explains why.
Tables and records
A table is a set of named columns, each an array of the same length. It is a DataFrame, or a SQL table. Each column has its own element type.
(Table {name: [`ann, `bo], age: [31, 27]}).ageA record is one row: a name for each value.
엄 0 (Table {name: [`ann, `bo], age: [31, 27]})Columns of different lengths are an error. Since lengths are data, its kind is domain:
Table {a: [1, 2], b: [1]}A table works like a matrix whose rows are along the first axis. A column can hold absent cells. The tables tutorial shows tables at work.
Partitions and groups
Two more kinds of value come out of grouping.
- A partition lists, for each key, the positions of its rows. 첮 makes one.
- Groups hold the values themselves, per key. Indexing an array by a partition makes them.
[20, 35, 40][첮 [`east, `west, `east] [20, 35, 40]]Only the grouped flow ㅔ takes groups. See groups.
Functions are not values
A block, a syllable with its operand, or a train is a function. A function is applied, not stored or printed. A line whose value would be a function is a type error:
{x × 2}The type rule
Every syllable has a type rule: from the types of its inputs and the values of its parameters, the rule gives the type of the result, or refuses. It never looks at the data itself. So an operation that is wrong is wrong on every input, not only on the input that happens to show it.
The rule draws one line through every value:
- Types: an element type, a rank, the shape of a column's cells, an enum's labels.
- Data: lengths, which elements are present, and the values themselves.
A mistake in the types is a type error. A mismatch in the data is a domain error. Two vectors of different lengths are a data mismatch:
[1, 2] + [1, 2, 3]A vector and a matrix differ in rank, which is a type. No lengths could make them fit:
[1, 2] + [[1, 2], [3, 4]]The checker refuses:
- element types the operation does not accept, such as a sum of Syms or a mean of texts;
- two element types that do not convert: only Int and Float meet;
- ranks that cannot meet;
- a wrong parameter, such as a negative count or a fill value of the wrong type, even when there is no data to apply it to;
- a function operand with the wrong number of inputs, such as
+where a one-input function belongs.
Which element types each operation accepts follows from its final. Sums need numbers, texts or Durations. Products need numbers. Max, min and sorting need an order, which every type but absence has. The operator reference gives the type of every syllable on arrays and on tables.
For each operation, the interpreter checks in a fixed order: parameters first, then the function operand, then the inputs' kinds and ranks, then element types, and only then lengths and values. So keys of the wrong type are a type error whatever their count, while the right type with the wrong count is a domain error.
There is no separate pass over the whole program yet. Each operation is checked when it runs, so a data error in an earlier step can still come out before a type error in a later one.