Writing Values
Strings, Numbers, Tables, and more
Ultimately the point of any program is to produce a value. The Technique language has several value types:
Unit
The unit type is written a : () -> ()\n and its
sole value Unitus is written { () }.
String literals
Literal text string in Technique are called Literali and are written as
you'd expect, enclosed with double-quotes:
{ "Late, as in the Late Arthur Dent" }.
Newlines can be included in strings, escaped with
\n.
We can also write multi-line strings, using triple quotes:
{ ```vogon
What do you mean you couldn't go to the local planning office at
Alpha Centauri? It's only four light-years away! Honestly, if you
can't be bothered to participate in democracy, you don't get to
complain about what happens next.
``` }
The optional "tag" is conventionally usually used to indicate the programming language, syntax, or interpretation of the string to follow.
Numbers
Numbers are either integrals which is to say signed integers, { 42 }, or quantities, which are
measurements with (optional) magnitude, (optional) uncertainty, and units. { 5.9722 ± 0.0006 × 10²⁴ kg } was the
mass of the planet earth, until about five minutes ago. Both kinds of number
are recorded as Quanticle values.
Responses
If you have a fixed response you need as a value can hard-code it as a Enumerati. These are the same form as the multiple choices offered when a step has a list of possible responses, but only a single response when written as a literal in an expression.
- Take prisoners to airlock { activate_door('OPEN') }
Key/Value Tables
Ultimately you need to label and group the values you create, and a tablet is the way to do this. A tablet returned by a procedure or function is a Tabularum value in Technique. A tablet value can be written
{ [
"colour" = "Cleaning Staff"
"status" = 'DEAD'
"duration" = 30000 years
"Who will clear away the bodies" = ?
] }
where {["colour"=1]}, {["status"=1]}, etc are the fields, and each is
assigned a value using =.
We also see the hole character { ? },
indicating a Futurae, a value to be supplied later, at runtime. Normally you
don't need this, but sometimes you have to be explicit in your code about
values you don't know yet and might have to wait a few million years for.
Lists
There are times when you need to supply a list, for example to {foreach x in y} when iterating or as
arguments provided to a procedure whose signature requires a list. In those
situations you can write a tablet without labels and
inline, with values separated by commas { [6, 9] }, or as a block
{ [
"Men"
"Women"
"Small fuzzy creatures from Alpha Centauri"
] }
thus creating an Arraeum. Values in a list need to be of the same type.
Tuple
Finally, you can combine multiple values as a tuple, creating a
Parametriq value. These values do not have to be the same type, so { (2, 'MICE', "Frankie & Benji") } is
a valid tuple.