Consider the following function int -> bool -> bool:

let rec repeatNot (n:int) (b:bool) =
    if n = 0 then
        b
    elif n < 0 then
        repeatNot -n b
    else
        not (repeatNot (n-1) b)

Ideally, how does repeatNot n behave in terms of the value of n? Show that, in practice, repeatNot exceeds the maximum allowable recursion depth and fails for large inputs n.

Your work

Log in to submit your work and track progress.