I see. So I looked up orElse and I see that it (and andThen) are methods
of PartialFunction. Surprisingly, these aren't discussed at all in
Programming in Scala. Apparently, they're beyond the scope of the book.
I understand the chaining and how this benefits the library designer
(and the libr
As David has mentioned before on this list (and as I believe is mentioned in
the book as well) the concerns of a library designer and a library user are
somewhat different. Allowing the user of a library to provide a partial
function makes development using that library easier because the user
does
Personally I think Partial functions are great because you can chain
them ... see orEse. The other nice thing is pattern matching on
function arguments. For instance:
val x: PartialFunction[String,String] = {
case "dog" => "bark"
}
this PF is defined only if the argument is "dog". For anything