juan_gandhi: (Default)
[personal profile] juan_gandhi
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)

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

July 2025

S M T W T F S
  12345
6789 1011 12
13141516171819
20212223242526
2728293031  

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 15th, 2025 09:23 am
Powered by Dreamwidth Studios