blob: 75da1dc47ab0e3e150889ecc1ed98c83faf72781 (
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
|
(.module:
[library
[lux #*
[abstract
[monad (#+ do)]]
[control
["." maybe]]
[data
[collection
["." list]]]
[math
["." random]
[number
["n" nat]]]
["_" test (#+ Test)]]]
[\\library
["." / (#+ Apply)]])
(def: .public test
Test
(do random.monad
[left random.nat
right random.nat]
(<| (_.covering /._)
($_ _.and
(_.cover [/.composite]
(let [expected (n.+ left right)]
(case (\ (/.composite maybe.monad maybe.apply list.apply) on
(#.Some (list right))
(#.Some (list (n.+ left))))
(^ (#.Some (list actual)))
(n.= expected actual)
_
false)))
))))
|