The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

peter.hilton (233) [Avatar] Offline
#1 Mutually Recursive Functions is the first point in the book where I’m stuck wondering why? Somewhere, there’s a Manning editor asking ‘So What And Why Do I Care?’

Coming up with a real use case is obviously not easy, or you would have done so. However, if you don’t, then I’m having a hard time believing that this is ever something anyone needs to do. Right now I’m wondering whether the reason I’ve never written mutually recursive functions is because they’re a bad idea (e.g. unmaintainable), or because I wasn’t using this kind of functional language.

If you could come up with a better example, that would be great. If the only real example is something obscure - a use case that not everyone has, then that's useful to know too.

Note that this is made a little harder by the fact that the cat/hat functions don’t produce very interesting output. I quick look at the code suggested that (cat 400) would alternate between printing cat and hat, but it only outputs cat four times.
bill_cohagan (5) [Avatar] Offline
Writing a compiler would be a use case for mutually recursive functions.