Hacker News new | ask | show | jobs
by thope 2583 days ago
Have you seen the movie 'Inception' [0] ? This is the idea behind recursion: you are in some context, then dive into another (similar although not identical) context, then dive into another (similar although not identical) context, etc.

The 'reality' is the top level context.

You dive down to level 2 context by falling asleep; that would be the recursive function call.

In that dream, fall asleep and enter level 3 context. You are now recusrsively falling asleep.

In the movie, the characters wait for a signal to wake up and going one level up. This is the 'stopping condition' of a recursive call.

You can also see that as Matryoshka dolls.

Regarding the 'Inception' movie that's funny, because it popularized the '-ception' suffix to describe a recursive phenomenon [1]

[0] https://www.imdb.com/title/tt1375666/ [1] https://en.wikipedia.org/wiki/Inception#In_popular_culture