blob: c20c136882058575f2ae3d16b569fa388be3644e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
(.using
[library
[lux (.except local)
[abstract
[equivalence (.only Equivalence)]
[hash (.only Hash)]]
[control
["[0]" pipe]]
[data
[text
["%" format (.only Format)]]]
[macro
["^" pattern]]
[math
[number
["n" nat]]]
[meta
["[0]" symbol]]]]
["[0]" /
["[1][0]" variable (.only Variable)]])
(type: .public Constant
Symbol)
(type: .public Reference
(Variant
{#Variable Variable}
{#Constant Constant}))
(implementation: .public equivalence
(Equivalence Reference)
(def: (= reference sample)
(case [reference sample]
(^.template [<tag> <equivalence>]
[[{<tag> reference} {<tag> sample}]
(at <equivalence> = reference sample)])
([#Variable /variable.equivalence]
[#Constant symbol.equivalence])
_
false)))
(implementation: .public hash
(Hash Reference)
(def: equivalence
..equivalence)
(def: (hash value)
(case value
(^.template [<factor> <tag> <hash>]
[{<tag> value}
(|> value
(at <hash> hash)
(n.* <factor>))])
([2 #Variable /variable.hash]
[3 #Constant symbol.hash])
)))
(template [<name> <family> <tag>]
[(template: .public (<name> content)
[(<| {<family>}
{<tag>}
content)])]
[local ..#Variable /variable.#Local]
[foreign ..#Variable /variable.#Foreign]
)
(template [<name> <tag>]
[(template: .public (<name> content)
[(<| {<tag>}
content)])]
[variable ..#Variable]
[constant ..#Constant]
)
(`` (template: .public self
[(..variable (~~ (/variable.self)))]))
(def: .public format
(Format Reference)
(|>> (pipe.case
{#Variable variable}
(/variable.format variable)
{#Constant constant}
(%.symbol constant))))
|