Fast F#: Turning a While Loop into Recursion

preview_player
Показать описание
Here's a quick lesson of turning a While Loop into Recursion in #fsharp

=== Contact ===

=== Donate ===

=== Tags ===
Tags: #fsharp, #dotnet
Рекомендации по теме
Комментарии
Автор

I wish more languages had support for recursive tail-call elimination

remyclarke
Автор

My guess (and hope) is that when this gets compiled, the resulting instructions do not keep all intermediate values in memory. Is that correct? I'm asking because I was doing this with a task list Kata: using recursion to keep a command line interface active that says "type a task description" and then adds that to the existing list of tasks and calls itself again. It seemed better than the while loop to me, but I did worry that this would (after many many iterations) fill up the available memory.

WalterVos
Автор

is there a limit to how many recursion calls a function can make?

davkk