将Scala文件加载到解释器中以使用功能吗? [英] Load Scala file into interpreter to use functions?
本文介绍了将Scala文件加载到解释器中以使用功能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在文件而不是在类中定义了一些Scala函数,我想在Scala解释器中使用它们.我知道我可以说scala filename.scala
来简单地运行文件并退出解释器,但是我想先运行文件然后留在解释器中,以便进行一些测试.谁能告诉我如何将文件简单地加载到解释器中,以便我可以使用其中定义的功能?
I have some Scala functions defined in a file, not in a class, and I would like to use them in the Scala interpreter. I know I can say scala filename.scala
to simply run the file and exit the interpreter, but I would like to run the file and then stay in the interpreter so I can do some testing. Can anyone tell me how to simply load a file into the interpreter so I can use the functions defined within it?
推荐答案
类型:load /path/to/file
.
您可以通过键入:help
这篇关于将Scala文件加载到解释器中以使用功能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文