equal
deleted
inserted
replaced
501 if (l == 0) List("") |
501 if (l == 0) List("") |
502 else for (c <- cs; s <- combs(cs, l - 1)) yield s"$c$s" |
502 else for (c <- cs; s <- combs(cs, l - 1)) yield s"$c$s" |
503 } |
503 } |
504 |
504 |
505 combs("abc".toList, 2) |
505 combs("abc".toList, 2) |
|
506 |
|
507 |
|
508 // When writing recursive functions you have to |
|
509 // think about three points |
|
510 // |
|
511 // - How to start with a recursive function |
|
512 // - How to communicate between recursive calls |
|
513 // - Exit conditions |
506 |
514 |
507 |
515 |
508 |
516 |
509 // A Recursive Web Crawler / Email Harvester |
517 // A Recursive Web Crawler / Email Harvester |
510 //=========================================== |
518 //=========================================== |