- Download Scala from this page.
- Install Scala.
Follow the instructions given on the download page. For Ubuntu users, you will download a file called something like scala-2.10.3.tgz. Unpack this file and put a link to the scala/bin directory in your path. For example, do something like the following:cd ~/opt/scala # where you downloaded scala-2.10.3 tar xvzf scala-2.10.3.tgz echo "export PATH=$HOME/opt/scala/scala-2.10.3/bin:$PATH" >> ~/.bash_profile source ~/.bash_profile
- Download uacalc.jar.
Either point your browser to http://uacalc.org/uacalc.jar OR dowget http://uacalc.org/uacalc.jar
- Start the Scala REPL with UACalc dependencies.
In the directory where uacalc.jar is located do `scala -classpath uacalc.jar`.williamdemeo@kap:~/UACalc/UACalc_CLI/Jars$ scala -classpath uacalc.jar Welcome to Scala version 2.10.3 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_25). Type in expressions to have them evaluated. Type :help for more information. scala>
- Import UACalc classes and make some objects.
scala> import org.uacalc.alg.conlat.BasicPartition import org.uacalc.alg.conlat.BasicPartition scala> val a = new BasicPartition("|0,1|2,3|") a: org.uacalc.alg.conlat.BasicPartition = |0,1|2,3| scala> a res2: org.uacalc.alg.conlat.BasicPartition = |0,1|2,3| scala> val b = new BasicPartition("|0|1,2|3|") b: org.uacalc.alg.conlat.BasicPartition = |0|1,2|3| scala> a.compose(b) blocks: [[0,1],[2,3]] res3: org.uacalc.alg.conlat.BinaryRelation = [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]]
- Post a comment in the box below!
…and tell us about your experience with Scala and UACalc.