Ocaml fixed point implementation

Ocaml fixed point implementation

Its a little hard to understand the rationale of this problem. Not every function is going to have a fixed point. For example fun x -> (x + 1) mod 5. Not every function with a fixed point will reach the fixed point by repeated application from a distinct starting point. (I just did some googling, and fixed points like this are called attractive fixed points.)

Here are some comments:

  • You shouldnt use ==, which is the physical equality operator. You possibly want to use =, equality of values.

  • However, I dont see what the eq parameter is for. Perhaps the caller is allowed to specify what equality to use. If so, you should use this instead of ==.

Ocaml fixed point implementation

Leave a Reply

Your email address will not be published. Required fields are marked *