blob: 1f05cf2fd63322b0fa0d3a749bd0698e0e76034f (
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
|
(.module:
lux
(lux (control pipe)
(data [number]
text/format)
[macro "meta/" Monad<Meta>])
(luxc (lang (host [ruby #+ Ruby Expression Statement]))))
(def: #export translate-bool
(-> Bool (Meta Expression))
(|>> %b meta/wrap))
(def: #export translate-int
(-> Int (Meta Expression))
(|>> %i meta/wrap))
(def: #export translate-nat
(-> Nat (Meta Expression))
(|>> (:coerce Int) %i meta/wrap))
(def: #export translate-deg
(-> Deg (Meta Expression))
(|>> (:coerce Int) %i meta/wrap))
(def: #export translate-frac
(-> Frac (Meta Expression))
(|>> (cond> [(f/= number.positive-infinity)]
[(new> "(1.0/0.0)")]
[(f/= number.negative-infinity)]
[(new> "(-1.0/0.0)")]
[(f/= number.not-a-number)]
[(new> "(0.0/0.0)")]
## else
[%f])
meta/wrap))
(def: #export translate-text
(-> Text (Meta Expression))
(|>> %t meta/wrap))
|