Write a function, persistence, that takes in a positive parameter
num and returns its multiplicative persistence, which is the number of times you must multiply the digits in
num until you reach a single digit.
persistence-recursive is a linear recursive process while
persistence-iterative is a linear iterative process. SICP has a great visual explanation of each.
persistence-recursive: Grows the stack and potential stack overflow, but doesn’t need to maintain state.
persistence-iterative: Doesn’t grow the stack and no stack overflow, but needs to update state. Additionally, cljs isn’t tail call optimized (TCO), so we need to use
Find this post useful? Share the love! Tweet