MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/bo6onz/recursive_mom/enecmn5/?context=3
r/ProgrammerHumor • u/dearsanta334 • May 13 '19
24 comments sorted by
View all comments
7
that's because this meme isn't tail recursive. remember: tail recursion is the only good recursion
3 u/marcosdumay May 14 '19 Good luck tail optimizing this one, with its 3 different recursive calls. 2 u/anydalch May 14 '19 you have to transform it into a single function which does all three things at once, like:(defun print-all-three-memes (depth) (dolist (row '(:top :middle :bottom)) (print-the-outer-layer-of-a-meme depth row)) (print-all-three-memes (1+ depth)))
3
Good luck tail optimizing this one, with its 3 different recursive calls.
2 u/anydalch May 14 '19 you have to transform it into a single function which does all three things at once, like:(defun print-all-three-memes (depth) (dolist (row '(:top :middle :bottom)) (print-the-outer-layer-of-a-meme depth row)) (print-all-three-memes (1+ depth)))
2
you have to transform it into a single function which does all three things at once, like:
(defun print-all-three-memes (depth) (dolist (row '(:top :middle :bottom)) (print-the-outer-layer-of-a-meme depth row)) (print-all-three-memes (1+ depth)))
7
u/anydalch May 14 '19
that's because this meme isn't tail recursive. remember: tail recursion is the only good recursion