jackpot@lemmy.mlBanned to Programming · 1 年前when is it best to use a recursive function vs a for loopmessage-squaremessage-square52linkfedilinkarrow-up134arrow-down13
arrow-up131arrow-down1message-squarewhen is it best to use a recursive function vs a for loopjackpot@lemmy.mlBanned to Programming · 1 年前message-square52linkfedilink
minus-squarecoloredgrayscalelinkfedilinkarrow-up2·1 年前A naive iterative implementation would be by adding and removing the folders/files from a list. If tail call optimization works on the (recursive) example then that’s (kinda) the compiler turning a recursive function into a loop.
A naive iterative implementation would be by adding and removing the folders/files from a list.
If tail call optimization works on the (recursive) example then that’s (kinda) the compiler turning a recursive function into a loop.