blob: f84c700d430b3caa1008a59c79952981bfcdae13 (
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
|
(.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-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))
|