Arc-Lang

A programming language for data stream processing.


type Item = {name:String, price:f64, mass:f64};
type Order = {id:u32, items: Vec[Item], t:Time, src_id:u32, dst_id:u32};
type Location = {id:u32, lon:f64, lat:f64};

val model: Model = open("cost_predictor.onnx").read_bytes().load_model();
val locations: Set[Location] = open("locations.csv").read_bytes().decode(csv());

---rust
fn distance(src: Location, dst: Location) -> f64 { /* ... */ }
---

from o:Order in source(kafka("127.0.0.1:9092", "orders"), json())
join src in locations on src.id == o.src_id
join dst in locations on dst.id == o.dst_id
with features = [
  o.items.map(_.mass).sum(),
  o.t.day().to_f64(),
  distance(src, dst)
].into_matrix()
with prediction = model.predict(features)
select {o.id, shipment_cost: prediction[0]}
into sink(kafka("127.0.0.1:9092", "cost_predictions"), json());

Get Started ⇩

Overview

Arc-Lang is a programming language for processing data streams.

Features

Installation


$ git clone https://github.com/cda-group/arc -b klas/v0.1.0 --single-branch
$ cargo install --path arc/arc-lang

Usage


$ arc-lang
>> print("Hello world!");
Hello world!

An example


$ for i in {1..100}; do echo $RANDOM; done > data.csv
$ arc-lang
>> from n:i32 in source(file("data.csv"), csv())
   select {result:n+1}
   into sink(file("output.csv"), csv());

More