gpt4 book ai didi

scala - 查找 Scala Array 深层文档?

转载 作者:行者123 更新时间:2023-12-01 13:14:20 25 4
gpt4 key购买 nike

SO answer by Jerry包括 deep 的这种使用:

println(k.deep)

工作原理:
scala> println(Array(10, 20, 30, 40).deep)
Array(10, 20, 30, 40)

我正在寻找有关 deep 的文档对于 Array .我去 Scala Standard Library 2.13.0 Array并在页面上搜索 deep并且没有匹配项。

Scala Array w search for 'deep'

这个顺序不正确怎么办?

最佳答案

根据 https://github.com/scala/bug/issues/10985,它似乎已从 Scala 2.13 中删除。 :

It's a hacky ugly testing utility to print values in (nested) arrays. If you feel strongly about it, we can add it deprecated.



您仍然可以在 2.12 docs 中找到它并在 2.12 branch :
  /** Creates a possible nested `IndexedSeq` which consists of all the elements
* of this array. If the elements are arrays themselves, the `deep` transformation
* is applied recursively to them. The `stringPrefix` of the `IndexedSeq` is
* "Array", hence the `IndexedSeq` prints like an array with all its
* elements shown, and the same recursively for any subarrays.
*
* Example:
* {{{
* Array(Array(1, 2), Array(3, 4)).deep.toString
* }}}
* prints: `Array(Array(1, 2), Array(3, 4))`
*
* @return An possibly nested indexed sequence of consisting of all the elements of the array.
*/
def deep: scala.collection.IndexedSeq[Any]

关于scala - 查找 Scala Array 深层文档?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56918171/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com