An implementation of Interaction Nets in JavaScript.

Overview

Interaction Nets

An implementation of Interaction Nets in JavaScript.

  • Use S-expression as overall syntax.
  • Use Forth-like postfix stack-based syntax to build Interaction Nets.

Introduction

Interaction nets is an interesting computation model designed by Yves Lafont in 1990, It uses undirected graphs and graph rewriting to express computations.

It is interesting because:

Our interaction nets are deterministic in a strong sense:

not only the result, but also the computation is unique, up to trivial commutations.

-- Interaction Combinators, Yves Lafont, 1997

References

Papers:

Books:

Usage

Online playground

Visit the INet Playground.

Command line tool

The command line program is called inet.

Install it by the following command:

npm -g i @cicada-lang/inet

Examples

Natual number

[ PLAYGROUND ]

(define-cons zero 0)
(define-cons add1 1)

(define-elim add 2)
(define-rule (zero add))
(define-rule (add1 add) add add1)

(define-net two
  zero add1
  zero add1
  add)
inet render docs/tests/nat.inet
two.initial two.finial

List

[ PLAYGROUND ]

(define-cons sole 0) ;; Trivial data for testing.

(define-cons null 0)
(define-cons cons 2)

(define-elim append 2)
(define-rule (null append))
(define-rule (cons append) (let head) append head cons)

(define-net six-soles
  null sole cons sole cons sole cons
  null sole cons sole cons sole cons
  append)
inet render docs/tests/list.inet
six-soles.initial six-soles.finial

Difference list

[ PLAYGROUND | WIKIPEDIA ]

(define-cons sole 0) ;; Trivial data for testing.

(define-cons null 0)
(define-cons cons 2)

(define-cons diff 2)

(define-elim diff-append 2)
(define-rule (diff diff-append)
  (let that left right)
  left that diff-open right diff)

(define-elim diff-open 2)
(define-rule (diff diff-open)
  (let right) connect right)

(define-net one-two-soles
  wire sole cons diff
  wire sole cons sole cons diff
  diff-append)

(define-net two-two-soles
  wire sole cons sole cons diff
  wire sole cons sole cons diff
  diff-append)
inet render docs/tests/diff-list.inet
one-two-soles.initial one-two-soles.finial
two-two-soles.initial two-two-soles.finial

Development

npm install    // Install dependencies
npm run build  // Compile `src/` to `lib/`
npm run watch  // Watch the compilation
npm run test   // Run test

Contributions

Be polite, do not bring negative emotion to others.

License

You might also like...

A JavaScript implementation of Michael Baker's Miner2149

miner2149-js A JavaScript implementation of Michael Baker's Miner2149. This repository is for personal use only. Not for commercial use or distributio

Jan 11, 2022

A fast simplex noise implementation in Javascript.

simplex-noise.js API Documentation simplex-noise.js is a simplex noise implementation in Javascript/TypeScript. It works in the browser and nodejs. Us

Jan 2, 2023

A javascript text differencing implementation.

jsdiff A javascript text differencing implementation. Based on the algorithm proposed in "An O(ND) Difference Algorithm and its Variations" (Myers, 19

Jan 7, 2023

javascript implementation of logistic regression/c4.5 decision tree

LearningJS: A Javascript Implementation of Logistic Regression and C4.5 Decision Tree Algorithms Author: Yandong Liu. Email: yandongl @ cs.cmu.edu Upd

Aug 19, 2022

ParkyDB - block based, linkable and verifiable document database -- javascript reference implementation

ParkyDB - block based, linkable and verifiable document database -- javascript reference implementation

Ancon ParkyDB A data mesh database using Web 3.0 technology Note: Requires Node v17.7.2 and up for development More about data mesh architecture Block

Aug 16, 2022

An implementation of (Untyped) Lambda Calculus in JavaScript.

Lambda Calculus More restraint and more pure, so functional and so reduced. -- Anonymous Bauhaus Student An implementation of (Untyped) Lambda Calculu

Nov 17, 2022

An Open-Source JavaScript Implementation of Bionic Reading.

bionic-reading Try on Runkit or Online Sandbox An Open-Source JavaScript Implementation of Bionic Reading API. ⚙️ Install npm i bionic-reading yarn ad

Dec 16, 2022

A tiny CRDT implementation in Javascript.

Tiny Merge A tiny CRDT implemented in Javascript. The philosophy behind Tiny Merge is to strategically reduce the functionality of CRDT's in favour of

Dec 2, 2022

An Open-Source JavaScript Implementation of Bionic Reading.

An Open-Source JavaScript Implementation of Bionic Reading.

TextVide (vide; Latin for "see") Support all languages that separate words with spaces Try on Runkit or Online Sandbox An Open-Source JavaScript Imple

Dec 16, 2022
Owner
Cicada Language
Let's build a bridge between writing software and doing mathematics.
Cicada Language
The Easel Javascript library provides a full, hierarchical display list, a core interaction model, and helper classes to make working with the HTML5 Canvas element much easier.

EaselJS EaselJS is a library for building high-performance interactive 2D content in HTML5. It provides a feature-rich display list to allow you to ma

CreateJS 8k Dec 29, 2022
High performance and SEO friendly lazy loader for images (responsive and normal), iframes and more, that detects any visibility changes triggered through user interaction, CSS or JavaScript without configuration.

lazysizes lazysizes is a fast (jank-free), SEO-friendly and self-initializing lazyloader for images (including responsive images picture/srcset), ifra

Alexander Farkas 16.6k Jan 1, 2023
a JavaScript library that allows you to make a mouse interaction animation easily.

Cotton.JS is a JavaScript library that allows you to make a mouse interaction animation easily. Getting Started Download npm install cottonjs Manual

Wilson Wu 20 Dec 27, 2022
high performance、complex interaction table

功能描述 1、高性能、满足复杂交互的编辑表格 2、基于: antd4(https://ant.design/index-cn) ag-grid(https://www.ag-grid.com/) 3、基于原生ag-grid 的API进行封装 一、主要功能 将按下列顺序逐步迭代 1、通用编辑功能 ??

wheel-team 4 Feb 15, 2022
Elrond blockchain CLI helper tools - interaction with APIs, smart contracts and protocol

Buildo Begins ?? Meet Buildo. He is here to help you start creating in the Elrond blockchain ecosystem. Here is where everything begins. I'm going on

Elrond's Dev Guild 22 Dec 30, 2022
A simple library to view large images up close using simple mouse interaction, and the full screen.

Intense Images A stand alone javascript library for viewing images on the full, full screen. Using the touch/mouse position for panning. Here's a demo

Tim Holman 2.6k Dec 31, 2022
wagmi hooks 🤝 Storybook interaction testing

A quick demonstration of how Storybook decorators can be combined with a mocked wagmi client to facilitate automated interaction testing for web3-enab

Mike Ryan 21 Dec 13, 2022
A robust, minimal-server-interaction API for peer routing in the browser

Robust, minimal-server-interaction peer routing in the browser What is this? Membrane takes signalling to the browser, creating living peer networks.

Elijah Bodden 13 Jan 6, 2023
Simple Library implemented using HTML, CSS and JavaScript. This is a simple implementation of JavaScript Modules of ES6.

Awesome-books A single page project with the porpuse of storing books' titles and authors. Built With CSS, HTML & Javascript. How to run in your local

Saadat Ali 7 Feb 21, 2022
Javascript implementation of flasher tool for Espressif chips, running in web browser using WebSerial.

Javascript implementation of esptool This repository contains a Javascript implementation of esptool, a serial flasher utility for Espressif chips. Un

Espressif Systems 103 Dec 22, 2022