on 492ae2f help sign in
53 lines 996 B history raw
1---
2sort: 10
3---
5# Type manipulation (`^` runes).
7`$cast`, `$like`, and `$name` let us adjust spans without
8violating type constraints.
10The `nest` algorithm which tests span subtyping is conservative;
11it never allows invalid nests, it sometimes rejects valid nests.
13## Regular forms
15### `:like`, `^+`, "ketlus", `{$like p/twig q/twig}`
17Syntax: *2-fixed*.
19The product is the formula of `q` with the span of `p`, provided
20nouns within the span of `q` can be shown to nest within the span
21of `p`.
23### `:cast`, `^-`, "ketlus", `{$like p/moss q/twig}`
25Syntax: *2-fixed*.
27Expands to: `:like($.p q)`.
29`$like` is a typecheck by example; `$cast` is a typecheck by
30mold.
32### `:name`, `^=`, "kettis", `{$name p/@tas q/twig}
34Syntax: *2-fixed*.
36The product: the formula of `q`, with the span of `q` labeled by
37symbol `p`.
39### Irregular forms
41### Backtick cast: `\`foo\`bar`
43Translation:
44```
45`foo`bar ^-(foo bar)
46```
48### Infix name: `foo=bar`
50Translation:
51```
52foo=bar ^=(foo bar)
53```