Giter Club home page Giter Club logo

clocky-lang's Introduction

Clocky

Clocky is a very-WIP functional-reactive programming language with type-level clocks. It's primarily inspired by Async RaTT and Rhine.

The idea is to eventually allow audio programming that can mix high-level control with low-level synthesis and analysis. Performance is nowhere near good enough for that yet, though.

Clocky is currently implemented with a bespoke compiler to WebAssembly. You can play with the language in its sketchbook interface.

Language overview

Let's start by looking at the type of that classic functional building block, map:

for a : type. for b : type. for k : clock.
  [](a -> b) -> ~^(k) a -> ~^(k) b

In a more mathematical notation, we might write the body of that type as

$$\square (a \to b) \to {\sim}^k\, a \to {\sim}^k\, b$$

${\sim}^k, a$ is a stream of values of type $a$ that runs at clock $k$. What this means is that we can get access to the current value of the stream right now, but we have to wait until clock $k$ ticks to get the rest of the stream. Clocky has a notion of "time" built-in--we can reason about what we can do now versus later.

Accessing further parts of a stream is something we can only do later, but there are some things we can only do now, like accessing a function we have lying around: that function might depend on precisely-timed streams! This is why map needs a "boxed" function $\square (a \to b)$, which ensures that it is time-invariant and can continue to be called in the future.

Local installation/development

Install a Rust nightly toolchain for both your host architecture as well as wasm32-unknown-unknown, then run

cargo +nightly -Z bindeps build --release

To build the sketchbook interface, install wasm-pack and npm, then run

wasm-pack build
cd sketching
npm run build

clocky-lang's People

Contributors

jmgrosen avatar

Stargazers

postsolarpunk avatar Rylee Alanza Lyman avatar Jeff Blagdon avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.