What are you trying to accomplish exactly?
What type do you want fib to have?I usually use lazy and force to get around let rec limitations and that usually allows for only local uglyness, the lazy types usually don't escape.
>
> On Jul 12, 2016 5:37 PM, "Hongbo Zhang (BLOOMBERG/ 731 LEX)" <hzhang295@bloomberg.net> wrote:
>>
>> Hi all,
>> I have a question simplified as below:
>>
>> let rec fib = fun x -> fib (x - 1);;
>> val fib : int -> 'a = <fun>
>> # let rec fib = (Obj.magic (fun x -> fib (x - 1)) : int -> 'a);;
>> Characters 15-47:
>> let rec fib = (Obj.magic (fun x -> fib (x - 1)) : int -> 'a);;
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> Error: This kind of expression is not allowed as right-hand side of `let rec'
>>
>> I know `fib` is a legal expression, is there any way to work around it?
>> Thanks -- Hongbo