-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpr7.spl
More file actions
26 lines (21 loc) · 822 Bytes
/
pr7.spl
File metadata and controls
26 lines (21 loc) · 822 Bytes
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
let postfixwithA:string = "a";;
let postfixwithB:string = "b";;
let postfix (lang:set post:string):set =
(if (seteq lang {})
then {}
else (cons (strapp (head lang) post) (postfix (tail lang) post)))
;;
let union (first:set second:set):set =
(if (seteq first {})
then (if (seteq second {}) then {} else (union second {}))
else (cons (head first) (union (tail first) second)))
;;
let restrict (ins:set num:int):set =
(if (== num 0) then {}
else (if (seteq ins {}) then {}
else (cons (head ins) (restrict (tail ins) (- num 1)))))
;;
let setOneTwoUnion:set = (restrict (sort (union arg0 arg1)) maxoutput) in
(postfix setOneTwoUnion postfixwithA);;
let setTwoThreeUnion:set = (restrict (sort (union arg0 arg2)) maxoutput) in
(postfix setTwoThreeUnion postfixwithB);;