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
Post a Comment