unnatural transformation
Dec. 20th, 2018 01:22 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
scala> def f(x: AnyRef) = System.identityHashCode(x) f: (x: AnyRef)Int scala> def s = Set("a", "bc", "def") s: scala.collection.immutable.Set[String] scala> val list = List(s, s) list: List[scala.collection.immutable.Set[String]] = List(Set(a, bc, def), Set(a, bc, def)) scala> val s1 = list.map(f).toSet s1: scala.collection.immutable.Set[Int] = Set(508760925, 1987354705) scala> val s2 = list.toSet.map(f) s2: scala.collection.immutable.Set[Int] = Set(508760925)
no subject
Date: 2018-12-20 09:46 am (UTC)You want
but that's a good puzzler!
no subject
Date: 2018-12-20 10:15 am (UTC)no subject
Date: 2018-12-20 12:53 pm (UTC)