Skip to content

strymonas/strymonas-scala

Repository files navigation

strymonas is a library providing fast-streams for Scala 3 through multi-stage programming and partial evaluation.

ci Join the chat at https://gitter.im/strymonas/strymonas

How to Use

import scala.quoted.staging._
import strymonas._
import strymonas.Code.given

given Code.Compiler = Compiler.make(getClass.getClassLoader)
given raw: Raw = Raw(Code)

val t = run {
  // Write a streaming operation here
  Cooked.of_int_array(Array(1,2,3,4,5,6,7,8,9,10)).fold(0, (_+_))
}

println(t)

Construct a streaming pipeline using the Cooked Object (defined in Stream.scala).1 Then, invoke the pipeline with scala.quoted.staging.run.

Refer to the examples directory for more details.

How to Build

strymonas is built with SBT 1.7.1 or later.

  • Use sbt compile to build the project from the source
  • Use sbt test to run the tests
  • Use sbt bench/jmh:run to run the benchmarks

Prepare Environment

# 1. Install SBT: https://docs.scala-lang.org/getting-started/index.html, https://get-coursier.io/docs/cli-overview
## macOS Case:
brew install coursier && coursier setup # Maybe `source ~/.profile` or `reboot` is required

## Linux Case:
curl -fL https://github.com/coursier/coursier/releases/latest/download/cs-x86_64-pc-linux.gz | gzip -d > cs && chmod +x cs && ./cs setup
source ~/.profile # or reboot

# 2. Clone this repo
git clone git@github.com:strymonas/strymonas-scala.git
cd strymonas-scala

# 3. Compile via SBT
sbt compile

# 4. Clean compilation artifacts as needed
sbt clean
rm -rf target/ project/target/ project/project/

Contributors

Credits

strymonas has its origins in a paper published by Oleg Kiselyov (okmij.org), Aggelos Biboudis (@biboudis), Nick Palladinos (@palladin) and Yannis Smaragdakis (site) and this repo has its aim into making this library available for Scala 3.

The initial prototypes (that correspond directly to the paper, were developed for Scala/LMS and OCaml/BER MetaOCaml) and the initial commit for the Scala 3 port is based on the case study presented for the paper published by Nicolas Stucki @nicolasstucki.

Footnotes

  1. If you are familiar with machine learning frameworks, you can think of this as an analogy to a Static Computational Graph.