Рекурсия
Область использования понятия | Цифровая |
---|---|
Ages | 12 |
FieldActivity | Computational Thinker |
Рекурсия — определение, описание, изображение какого-либо объекта или процесса внутри самого этого объекта или процесса, то есть ситуация, когда объект является частью самого себя. В программировании чаще всего - вызов функцией себя самой.
Понять рекурсию
Введение в рекурсию в книге Харви о стиле Лого - http://people.eecs.berkeley.edu/~bh/v1ch7/recur1.html
When you're thinking about a recursive procedure, it's especially important to remember that each invocation of a procedure has its own local variables. It's possible to get confused about this because, of course, if a procedure invokes itself as a subprocedure, each invocation uses the same names for local variables. For example, each invocation of downup has a local variable (its input) named word. But each invocation has a separate input variable.
How Recursion Works В книге Simple Scheme
The crowning achievement of the little-people model is explaining recursion. Remember that every time you call a procedure, a little person is hired to compute the result. If you want to know (+ 2 (+ 3 4)), there are two separate plus specialists involved.