scala - Why does not Set implement PartialFunction? -


programming in scala: comprehensive step-by-step guide, 2nd edition, page 546:

in inheritance hierarchy below iterable find 3 traits: seq, set, , map. common aspect of these 3 traits implement partialfunction trait apply , isdefinedat methods.

however, code not compile (tried both 2.8.2 , 2.10.2):

set(1, 2, 3).isdefinedat(1) 

with error:

value isdefinedat not member of scala.collection.immutable.set[int] 

is mistake in book?

sure looks it. going far scala 2.5.0:

it seems sensible: set maps objects boolean values, it's always defined (true members, false nonmbers).


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -