Kojo-Lib provides Kojo (the Scala based learning environment) as a library that you can use with:
- Scala 3 or Scala 2.13.x, and any Scala IDE (Intellij IDEA, Visual Studio Code + Metals, etc).
- Any JVM language (that is able to consume Java jar files).
-
Check that you have
scala-cli
in terminal. If you install latestscala
from https://www.scala-lang.org/download/ via (Coursier)cs setup
you will also getscala-cli
. You can also installscala-cli
separately from https://scala-cli.virtuslab.org/ -
Download this file: https://github.com/litan/kojo-lib/releases/download/v0.3.0/kojo-english.scala
-
Start the Scala REPL in the same dir as the above file with this command:
scala-cli repl .
- Type
forward()
by thescala>
prompt:
Welcome to Scala 3.1.2 (17.0.2, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala> forward()
-
You should now see the Kojo turtle draw a red line in a new window.
-
For further information see here, including how to get Kojo started with a specific local language.
-
Check that you have
sbt
in terminal. If you install latestscala
from https://www.scala-lang.org/download/ viacs setup
you will also getsbt
. You can also installsbt
separately from https://www.scala-sbt.org/ -
Add the following dependency in your
build.sbt
file:
val kojoLibVersion = "0.3.0"
libraryDependencies += "net.kogics" % "kojo-lib" % kojoLibVersion from
s"https://github.com/litan/kojo-lib/releases/download/v$kojoLibVersion/kojo-lib-assembly-$kojoLibVersion.jar"
-
Start
sbt
and typeconsole
inside sbt to start the Scala REPL -
Type
forward()
by thescala>
prompt:
Welcome to Scala 3.1.2 (17.0.2, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
scala> forward()
-
You should now see the Kojo turtle draw a red line i a new window.
-
For further information see here, including how to get Kojo started with a specific local language.
- Clone this repo.
- Go into the repo dir in a terminal.
- run
./sbt.sh buildDist
to get thedist
anddist-scala
dirs (explained below). - run
./sbt.sh assembly
to get a fat kojo-lib-assembly-x.y.z.jar in target/scala-2.13
This will give you two folders of interest:
dist
- which contains jars that you can use (on the classpath) with any JVM language. Note - you can also use the latest kojo-lib-assembly-x.y.z.jar release jar in place of these jars.dist-scala
- which contains a couple of Scala jars that you need to include in your classpath for any language other than Scala.
Coming soon (jars published on maven central).
Enjoy!