add range (like python) and id helper functions

This commit is contained in:
Vladan Popovic 2022-12-06 04:20:12 +01:00
parent 538693d9f4
commit 57da947edf
1 changed files with 8 additions and 0 deletions

View File

@ -25,3 +25,11 @@ let uncurry3 f (x, y, z) = f x y z
let swap x y = y x
let pair_of_list l = (List.hd l, List.tl l |> List.hd)
let range x =
let rec aux n res =
if n = 0 then res
else aux (n - 1) (n :: res) in
aux x []
let id x = x