이것은 IntelliJ의 Scala REPL로 놀면서 흥미로운 일입니다.IntelliJ Scala REPL에서 동일한 개체가 생성 된 방법에 따라 다른 출력물을 얻는 이유는 무엇입니까?
을 감안할 때이 두 라인 :
val myVector = Vector.tabulate(10)((x: Int) => x + 1)
val myVector2 = (1 to 10).toVector
REPL 인쇄 :
myVector: scala.collection.immutable.Vector[Int] = Vector(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
myVector2: Vector[Int] = Vector(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
왜 첫 공연을 전체 경로를 않습니다 (scala.collection.immutable.Vector [지능), 그동안 두 번째 벡터 [Int]입니까?
은 실제로 같은 클래스 것을 내가 확인 한 모든 기지를 커버하려면myVector: Class[?0] = class scala.collection.immutable.Vector
myVector2: Class[?0] = class scala.collection.immutable.Vector
이 무엇보다 호기심의 더하지만이 사용할 가능성이 가장 높은 초보자를위한 혼동 될 수있다 REPL.
이 우수한 응답 @ 솜 - snytt입니다. 고마워, 나는 오늘 새로운 것을 배웠다. –