Scala - 获取绑定变量列表? [英] Scala - get list of bound variables?
问题描述
有没有办法在 Scala 中获取绑定变量列表?
Is there any way to get a list of bound variables in scala?
推荐答案
在 2.9、2.10 和 2.11 的 :power
模式下,您可以 intp.visibleTermNames.sorted.foreach(println)
获取所有内容,或者 intp.definedTerms.foreach(println)
获取您创建的内容.
In :power
mode in 2.9, 2.10, and 2.11 you can intp.visibleTermNames.sorted.foreach(println)
to get everything, or intp.definedTerms.foreach(println)
for just the things you've created.
在 2.10 中,$intp
总是可见的(电源模式或无),所以 $intp.definedTerms.foreach(println)
将打印一个非电源列表模式.
In 2.10, $intp
is always visible (power mode or no), so $intp.definedTerms.foreach(println)
will print a list in non-power mode.
在电源模式下尝试 intp.
+tab 以列出所有可用的方法.(以 $
开头的符号没有启用制表符补全.)
Try intp.
+tab in power mode to list all the methods available. (Symbols starting with $
don't have tab-completion enabled.)
这篇关于Scala - 获取绑定变量列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!