mv lab 07 to 06
This commit is contained in:
6 files changed
+136
No files matched your search
@@ -0,0 +1,18 @@
|
||||
let return x = [x]
|
||||
|
||||
let ( >>= ) l f = List.concat_map f l
|
||||
|
||||
let gaurd cond l =
|
||||
if cond then l else []
|
||||
|
||||
let multiply_to n =
|
||||
List.init n ((+) 1) >>= fun x ->
|
||||
List.init n ((+) 1) >>= fun y ->
|
||||
gaurd (x * y = n) [(x, y)]
|
||||
|
||||
let ( let* ) = ( >>= )
|
||||
|
||||
let multiply_to' n =
|
||||
let* x = List.init n ((+) 1) in
|
||||
let* y = List.init n ((+) 1) in
|
||||
if x * y = n then [(x, y)] else []
|
||||
Reference in new issue
Block a user