let repeat n f =
    if n < 1 then failwith "cannot execute a function less than 1 time"
    else
      fun a ->
        for i = 1 to n-1 do ignore (f a) done;
        f a