Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala - get list of bound variables?

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

like image 328
Reyan Avatar asked Jan 08 '13 19:01

Reyan


1 Answers

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.)

like image 129
Rex Kerr Avatar answered Oct 05 '22 23:10

Rex Kerr