# HG changeset patch # User Christian Urban # Date 1480600236 0 # Node ID 3cbe3d90b77f2bd00c154d1afbab37d66a524636 # Parent bc0e0aa4dee1607c8e61acddff4037751a268582 updated diff -r bc0e0aa4dee1 -r 3cbe3d90b77f progs/lecture2.scala --- a/progs/lecture2.scala Thu Dec 01 12:19:52 2016 +0000 +++ b/progs/lecture2.scala Thu Dec 01 13:50:36 2016 +0000 @@ -207,6 +207,10 @@ println(season("November")) +// What happens if no case matches? + +println(season("foobar")) + // User-defined Datatypes //======================== diff -r bc0e0aa4dee1 -r 3cbe3d90b77f progs/lecture3.scala --- a/progs/lecture3.scala Thu Dec 01 12:19:52 2016 +0000 +++ b/progs/lecture3.scala Thu Dec 01 13:50:36 2016 +0000 @@ -116,9 +116,17 @@ searchT(111, junk_coins, start_acc) searchT(111111, junk_coins, start_acc) -// moral: whenever a recursive function is resource-critical -// (i.e. works on large recursion depth), then you need to -// write it in tail-recursive fashion +// Moral: Whenever a recursive function is resource-critical +// (i.e. works with large recursion depths), then you need to +// write it in tail-recursive fashion. +// +// Unfortuantely, the Scala is because of current limitations in +// the JVM not as clever as other functional languages. It can +// only optimise "self-tail calls". This excludes the cases of +// multiple functions making tail calls to each other. Well, +// nothing is perfect. + + // Polymorphic Types