jackpottoProgramming@programming.dev·10 months agowhen is it best to use a recursive function vs a for loopmessage-squarearrow-up134arrow-down13message-square52fedilink
arrow-up131arrow-down1message-squarewhen is it best to use a recursive function vs a for loopjackpottoProgramming@programming.dev·10 months agomessage-square52fedilink
minus-squarecoloredgrayscalearrow-up2arrow-down0·10 months agolinkfedilinkA 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.