This lecture covers Generating Functions(a way to represent sequences), their usage in solving some counting problems and recurrance equations.
Here are my notes...










/* Notice the argument of actor method, its a
* no-arg(not empty arg list)
* function that returns Unit */
def actor(body: => Unit): Actor = {
/* Here java style syntax of anonymous classes is being used.
* we're creating an instance not of Actor class but a anonymous
* subclass that is implementing a method act() which is declared
* in trait Reactor(also its evident that its not mandatory to use
* keyword override when implementing something from the trait)
* and overriding scheduler. */
val a = new Actor {
def act() = body
override final val scheduler: IScheduler = parentScheduler
}
/* also see that actor is started right here. */
a.start()
a
}
scala> def A[a](b:a){ println(b) }
A: [a](a)Unit
scala> A[String]("hi")
hi
scala> A[String](2)
:6: error: type mismatch;
found : Int(2)
required: String
A[String](2)
^ def receive[R](f: PartialFunction[Any, R]):R



