Reyan Reyan - 1 year ago 73
Scala Question

Scala - get list of bound variables?

Is there any way to get a list of bound variables in scala?

Answer Source

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.

In 2.10, $intp is always visible (power mode or no), so $intp.definedTerms.foreach(println) will print a list in non-power mode.

Try intp.+tab in power mode to list all the methods available. (Symbols starting with $ don't have tab-completion enabled.)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download