Scala equivalent of Python help()
Similarly, IDEA has its "Quick Documentation Look-up" command, which works for Scala as well as Java (-Doc) JARs and source-code documentation comments.
I do not know of one built-in but you should use Scaladocs to find the same information.
Unless you use eclipse which has an auto complete with short explanations. For instance it will give you all the commands for arrays after typing 'array.'.
sbt-man is a sbt plugin for looking up scaladoc. The sbt console
command starts the Scala REPL with project classes and dependencies on the classpath
Example:
man Traversable /:
[man] scala.collection.Traversable
[man] def /:[B](z: B)(op: (B ⇒ A ⇒ B)): B
[man] Applies a binary operator to a start value and all elements of this
collection, going left to right. Note: /: is alternate syntax for foldLeft;
z /: xs is the same as xs foldLeft z. Note: will not terminate for infinite-
sized collections. Note: might return different results for different runs,
unless the underlying collection type is ordered. or the operator is
associative and commutative.
I think tab completion is the closest thing to Python's help.
There is also a dated but still relevant post from @dcsobral on using Scala documentation and Scalex which is similar to Hoogle for Haskell.
This is the tab completion in the Object
Array
.
scala> Array.
apply asInstanceOf canBuildFrom concat copy
empty emptyBooleanArray emptyByteArray emptyCharArray emptyDoubleArray
emptyFloatArray emptyIntArray emptyLongArray emptyObjectArray emptyShortArray
fallbackCanBuildFrom fill isInstanceOf iterate newBuilder
ofDim range tabulate toString unapplySeq
This is for the methods on the class Array
. Not sure why this doesn't show value members after a.
scala> val a = Array(1,2,3)
a: Array[Int] = Array(1, 2, 3)
scala> a.
apply asInstanceOf clone isInstanceOf length toString update
Though a little daunting at times tab completion on a method shows the method signatures. Here it is for Array.fill
def fill[T](n1: Int, n2: Int)(elem: => T)(implicit evidence$10: reflect.ClassTag[T]): Array[Array[T]]
def fill[T](n1: Int, n2: Int, n3: Int)(elem: => T)(implicit evidence$11: reflect.ClassTag[T]): Array[Array[Array[T]]]
def fill[T](n1: Int, n2: Int, n3: Int, n4: Int)(elem: => T)(implicit evidence$12: reflect.ClassTag[T]): Array[Array[Array[Array[T]]]]
def fill[T](n1: Int, n2: Int, n3: Int, n4: Int, n5: Int)(elem: => T)(implicit evidence$13: reflect.ClassTag[T]): Array[Array[Array[Array[Array[T]]]]]
def fill[T](n: Int)(elem: => T)(implicit evidence$9: reflect.ClassTag[T]): Array[T]