4

SO answer by Jerry includes this use of deep:

println(k.deep)

Works as described:

scala> println(Array(10, 20, 30, 40).deep)
Array(10, 20, 30, 40)

I am looking for documentation on deep for an Array. I go to Scala Standard Library 2.13.0 Array and do a search of the page for deepand get no matches.

Scala Array w search for 'deep'

How is this the incorrect sequence?

CW Holeman II
  • 4,661
  • 7
  • 41
  • 72

1 Answers1

5

It seems it has been removed from Scala 2.13 according to https://github.com/scala/bug/issues/10985:

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

You can still find it in 2.12 docs and in 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]
Mario Galic
  • 47,285
  • 6
  • 56
  • 98
  • Is there a more direct route to finding the change, besides tracking back thru release notes for all old versions until stumbling upon the info? – CW Holeman II Jul 06 '19 at 23:30
  • Try searching the main repo https://github.com/scala/scala, for example https://github.com/scala/scala/search?q=deep+array&unscoped_q=deep+array&type=Issues – Mario Galic Jul 06 '19 at 23:47