Skip to content

litan/kojo-lib

Repository files navigation

Kojo Lib

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).

Quick Start using scala-cli

scala-cli repl .
  • Type forward() by the scala> 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.

Quick Start using sbt

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 type console inside sbt to start the Scala REPL

  • Type forward() by the scala> 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.

Doing a manual build (for any JVM language)

  • Clone this repo.
  • Go into the repo dir in a terminal.
  • run ./sbt.sh buildDist to get the dist and dist-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.

Minimal sample client programs

Examples (mostly from the Kojo Showcase menu)

Published artifacts

Coming soon (jars published on maven central).


Enjoy!