Friday, 27 November 2015

Little programming: recursive function call

I have found this good example on stackowerflow.com as an illustration of the recursive function call. This is really beautiful:

A child couldn't sleep, so her mother told a story about a little frog,
  who couldn't sleep, so the frog's mother told a story about a little bear,
     who couldn't sleep, so bear's mother told a story about a little weasel
       ...who fell asleep.
     ...and the little bear fell asleep;
  ...and the little frog fell asleep;
...and the child fell asleep.

In SQL SERVER a recursive query is good to compose a tree of Bill of Materials (BOM).

No comments:

Post a Comment