27 lines
537 B
Plaintext
27 lines
537 B
Plaintext
Location :: |{
|
|
unknown
|
|
known: (f32, f32)
|
|
}
|
|
|
|
describe: Location -> str: @ location: Location { match location {
|
|
|.unknown => 'unknown'
|
|
|.known (latitude, longitude) if latitude >= 0.0 => 'known'
|
|
|.known (_, _) => 'known'
|
|
} }
|
|
|
|
Point :: &{
|
|
x: i32:
|
|
y: i32:
|
|
}
|
|
|
|
sum_point: Point -> i32: @ point: Point {
|
|
{x as horizontal, y as vertical} :: point
|
|
horizontal + vertical
|
|
}
|
|
|
|
classify_array: []i32 -> str: @ values: []i32 { match values {
|
|
[] => 'empty'
|
|
[only] => 'one'
|
|
[first, ...rest] => 'many'
|
|
} }
|