blob: 0d73b1038bfaf6322151f8cd928cdcbe6f4ffc2a (
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 [io]
(control [monad {"+" [do]}]
pipe)
(data [text "text/" Eq<Text>]
[product]
(coll [list]))
["r" math/random "r/" Monad<Random>]
test)
(luxc (lang ["la" analysis]
["ls" synthesis]
(synthesis ["[0]S" expression])
["[0]L" extension]))
(// common))
(context: "Procedures"
(<| (times +100)
(do @
[num-args (|> r.nat (:: @ each (n/% +10)))
nameA (r.text +5)
argsA (r.list num-args gen-primitive)]
($_ seq
(test "Can synthesize procedure calls."
(|> (expressionS.synthesize extensionL.no-syntheses
(la.procedure nameA argsA))
(case> (^ [_ {#.Form (list& [_ {#.Text procedure}] argsS)}])
(and (text/= nameA procedure)
(list.every? (product.uncurried corresponds?)
(list.zip2 argsA argsS)))
_
#0)))
))))
|