我精通Python,但在Scala是noob。我即將在Scala中編寫一些髒實驗代碼,並且認爲如果Scala在Python中具有像help()
這樣的函數,它將非常方便。例如,如果我想查看Scala Array
的內置方法,則可能需要輸入類似help(Array)
的內容,就像我在Python中輸入help(list)
一樣。斯卡拉是否存在這樣的事情?Scala相當於Python的幫助()
5
A
回答
4
1
同樣,IDEA有其「快速文檔查找」命令,該命令適用於Scala以及Java(-Doc)JAR和源代碼文檔註釋。
3
我認爲選項卡完成是最接近Python的幫助。
還有一個日期但仍然相關的使用Scala文檔的@dcsobral的post和與Hoogle for Haskell類似的Scalex。
這是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
這是用於Array
類的方法。不知道爲什麼,這並不表明後a.
scala> val a = Array(1,2,3)
a: Array[Int] = Array(1, 2, 3)
scala> a.
apply asInstanceOf clone isInstanceOf length toString update
值的成員雖然在上一個方法次標籤完成有點犯難了該方法的簽名。這是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]
+0
製表符完成不會通過implicits添加成員。然而,對於我來說,tabb往往比scaladoc更容易(想到反思api)。 –
+0
Hmmm選項卡的完成看起來不如Python的'help()'優雅,但我想它符合其目的。謝謝! – Ray
1
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.
相關問題
- 1. Common Lisp的幫助,相當於在python幫助
- 2. Scala Hoogle相當於?
- 3. Scala相當於Ruby的map.each?
- 4. Ruby等於Python的幫助()?
- 5. 需要幫助Scala
- 6. 需要幫助轉換bash的代碼移植到Python相當於
- 7. 使用python幫助獲得關於MatchObject的幫助
- 8. scala:解析器幫助
- 9. MXNet - 什麼是python相當於獲得scala的mxnet networkExecutor.gradDict(「data」)
- 10. Haskell相當於Scala的組合
- 11. 在Scala中的LINQ SelectMany相當於
- 12. Scala相當於C#的表達式API
- 13. Python TKinter Threading幫助需要的幫助
- 14. 需要關於python sqlite的幫助?
- 15. Python相當於phpinfo()
- 16. python相當於sprintf
- 17. Python左()相當於?
- 18. python - strtotime相當於?
- 19. python相當於jstack?
- 20. JOptionPane相當於python?
- 21. Python的子幫助
- 22. 需要幫助相機API幫助
- 23. Python/Excel幫助
- 24. 幫助在Python
- 25. 幫助!在python
- 26. Python Pickle幫助
- 27. 相當於Java Python的json.dumps
- 28. 相當於Python中的「do.call」
- 29. 相當於Python dis()的Lua?
- 30. python相當於java的OutputStream?
tab完成在REPL:在SBT
console
命令與工程類和依賴的類路徑實例啓動斯卡拉REPL? – sschaef