F#: Mutually recursive functions [closed]?

You can also use let rec ... and form: let rec f x = if x>0 then g (x-1) else x and g x = if x>0 then f (x-1) else x.

Beat me to it by 42 seconds... :-) – Jon Harrop Sep 1 '10 at 18:56 +1, Nice, didn't realize you could use and with let bindings. I thought it's usage was restricted to type declarations. – JaredPar Sep 1 '10 at 19:02 It's specially useful (necessary) if you have mutually recursive types (like two DUs) and two functions that take each as an input argument.

– Stringer Sep 1 '10 at 19:11.

To get mutually recursive functions simply pass one to the other as a parameter let rec f g x = if x>0 then g (x-1) else x let rec g x = if x>0 then f g (x-1) else x.

Use the let rec ... and ... construct: let rec f x = if x>0 then g (x-1) else x and g x = if x>0 then f (x-1) else x.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions