Exercise generated programs with update sequences
This commit is contained in:
4 files changed
+385
-4
No files matched your search
+5
-1
@@ -19,7 +19,11 @@ let rec concat_map f = function
|
||||
| item :: rest -> f item @ concat_map f rest
|
||||
|
||||
let rec list_init count f =
|
||||
if count <= 0 then [] else f 0 :: list_init (count - 1) (fun index -> f (index + 1))
|
||||
if count <= 0 then []
|
||||
else
|
||||
let head = f 0 in
|
||||
let tail = list_init (count - 1) (fun index -> f (index + 1)) in
|
||||
head :: tail
|
||||
|
||||
let rec take count items =
|
||||
if count <= 0 then []
|
||||
|
||||
Reference in new issue
Block a user