Exercise generated programs with update sequences

This commit is contained in:
sneeker committed 2017-06-12 18:44:00 +00:00
1 parent bc80f1d459
commit abe98c29fb
4 files changed
+385 -4

No files matched your search

+5 -1
View File
@@ -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 []