updated
authorChristian Urban <christian dot urban at kcl dot ac dot uk>
Thu, 01 Dec 2016 13:50:36 +0000
changeset 77 3cbe3d90b77f
parent 76 bc0e0aa4dee1
child 80 ea0d0a862a9c
updated
progs/lecture2.scala
progs/lecture3.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
 //========================
 
--- 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