My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Links

Introduction

This package will provide utility functions to make it easier to use the interactive scala interpreter, and also to allow easier scripting with scala

Sample usage

$ scala
Welcome to Scala version 2.6.1-final.
Type in expressions to have them evaluated.
Type :help for more information.

We begin by importing helper, which is the object provided by this package

scala> import helper._
import helper._

helper.exec allows you to execute any command and get back the exit status along with the output

scala> exec ("find ../ -type d -maxdepth 1")
res0: (Int, List[String]) = (0,List(../, ../thunderbird, ../bin, ../man, ../share, ../info, ../lib, ../include, ../argo, ../eclipse, ../google-earth, ../etc, ../plugins, ../phrasebooks, ../examples, ../demos, ../doc, ../translations, ../mkspecs, ../jaxe-source, ../cursor_themes, ../libexec)

As you can see, the result of exec is a tuple that contains the exit code and list containing the output of the process (list of strings terminated with newlines)

scala> res0._2.length
res1: Int = 33

helper.? and helper.?? display information about their argument. ?? is same as ? but more verbose

scala> ?(res0)
scala.Tuple2
------------
hashCode
equals
toString
$tag
productElement
productArity
productPrefix
arity
element
_1
_2
wait
wait
wait
getClass
notify
notifyAll
res2: Any = ()

scala>
Powered by Google Project Hosting