2016-06-12 3 views
1

스칼라 REPL

:history 

:h? 

예에서 과거의 광고를 실행 보기와 REPL 기록을 검색 :

scala> :h? req 

19 :require /git/BIDMach/BIDMach.jar 
20 :require /git/BIDMat/BIDMat.jar 
21 :require /git/BIDMach_Spark/BIDMach_Spark.jar 
27 :require /git/BIDMach_Spark/BIDMatHDFS.jar 
28 :require /git/BIDMach_Spark/BIDMach_Spark.jar 

쇼 마지막 K 항목 :

:history 10 

26 :load /git/BIDMach_Spark/scripts/KMeansLearner.ssc 
27 :require /git/BIDMach_Spark/BIDMatHDFS.jar 
28 :require /git/BIDMach_Spark/BIDMach_Spark.jar 
29 :require /git/BIDMach/BIDMach.jar 
30 :load /git/BIDMach_Spark/scripts/KMeansLearner.ssc 
31 :q 
32 :require /git/BIDMat/BIDMat.jar 
33 :? 
34 :help 
35 :h? 

우리가 어떻게 번호가 기록 항목을 실행 합니까?

이 지원이 존재 하는가

:!29 

:history 29 

:29 

을 시도하고있다 팔로우? 아니면 자르고 붙이기로되어 있나?

+0

가장 가까운 것은': e' _ _ 다음에 위쪽 화살표가있는 것입니다. 그러면 편집/실행 프롬프트에 히스토리 행이 표시됩니다. – jwvh

+0

@jwvh 완벽. 답변을 추가하시면 보너스를드립니다. – javadba

+0

@jwvh btw how/어떻게 정보를 찾았습니까? – javadba

답변

1
scala> :help 
All commands can be abbreviated, e.g., :he instead of :help. 
:edit <id>|<line>  edit history //<-- hmm, this looks interesting 
:help [command]   print this summary or command-specific help 
:history [num]   show the history (optional num is commands to show) 
:h? <string>    search the history 
.....//etc. 

scala> :hi 6 
2524 val predicate: Int => Boolean = _ > 3 
2525 import scala.annotation._ 
2526 List(3,5,7,9,11).filter(_ %3 == 0) 
2527 Vector('a','b','c').length 
2528 :help 
2529 :hi 6 

scala> :e 2526 
Placing text in recent history. // follow this with a single up-arrow 

scala> List(3,5,7,9,11).filter(_ %3 == 1) // now this can be edited/executed 
res6: List[Int] = List(7) 

scala> :e predicate 
Placing text in recent history. // up-arrow again 

scala> val predicate: Int => Boolean = _ > 4 // edit and execute 
predicate: Int => Boolean = <function1>