~kylep/pipes

Yet another experimental lang about piping data around
Adjust snake
Fix snake, mod
UI improvements, fixes, obj unpacking

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~kylep/pipes
read/write
git@git.sr.ht:~kylep/pipes

You can also use your local clone with git send-email.

#PIPES

Yet another experimental lang about piping data around

Pipes includes as a foundational construct, pattern matching and rewriting.

Check out the playground here: https://kyleperik.com/pipes/

Warning, this language is a prototype and does not help you much with syntactic or runtime errors. Check the js console for some error information if something isn't working.

#Examples

These links point point to urls which encode the full text of the program, so they can get pretty long.

Fibonacci

Velocity

Line Drawing

Basic snake game

Fizzbuzz

#Overview

Pipes statements define what it should select, and what to generate with it.

'marco' : 'polo';

This basic snippet selects on any 'marco' input, and spits out 'polo' in response.

In reality, things are a bit more complicated than that, since you may have multiple sources of data incoming, not just strings.

The basic implementation of pipes includes devices to handle basic string input and output. To select a device, simply specify the type in your match/result statements.

['input', 'marco', state] : ['log', 'polo'];

Now this is a working program. Type 'marco' in the input textbox and enter, and you will see 'polo' logged below.

#References

To passthrough values received from input, don't specify a value for a key to give assign it to a reference, which can be used in the result.

['input', value, state] : ['log', value];

#Piping

This can get a bit verbose. You can simplify it a bit by abstracting out the extraction to and from devices by including multiple stages.

['input', value, state] : value
| 'marco' : 'polo'
| value : ['log', value];

Each stage selects for criteria, and has it's own result which is passed to the following stage to process.

You can include multiple rules within each step using grouping.

['input', value, state] : value | (

  'marco' : 'polo';
  'dog' : 'woof';

) | value : ['log', value];

#Definitions

Definitions enable you to package a set of rules into a reusable pattern, making use very succinct.

def input
  ['input', value, state] : value;

def log
  value : ['log', value];

input | 'marco' : 'polo' | log;