GithubHelp home page GithubHelp logo

cicada-lang / inet-js Goto Github PK

View Code? Open in Web Editor NEW
41.0 1.0 1.0 4.01 MB

This is an implementation of interaction nets. It introduces you to the bizarre world of graph-based computation and linear logic, using a familiar JavaScript-like syntax :)

Home Page: https://inet.run

License: GNU General Public License v3.0

JavaScript 0.07% Assembly 4.78% TypeScript 88.99% SWIG 6.16%
computation-model graph graph-processing inet interaction-nets interpreter language-design programming-language programming-language-concepts programming-language-design

inet-js's People

Contributors

xieyuheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

gacogo

inet-js's Issues

Odd type-checking fail with generic function parameters

Reproduction:

// Setup, a generic type and a few helper nodes
type Gen(Element: @Type)
type Normal
node del(
  value!: Normal
  ------
)
node normal(
  ------
  value!: Normal,
)
node passGen(
  valueIn!: Gen('A)
  ------
  valueOut: Gen('A)
)

// As a node, typechecks perfectly:
node testNode(
  paramGen: Gen(Normal),
  paramNormal!: Normal
  ------
  out: Gen(Normal),
)
rule testNode(paramGen, paramNormal!, out) normal(value!) {
  let paramNormal = normal()

  del(paramNormal)
  let variable = passGen(paramGen)

  @connect(variable, out)
}

// As a function, fails to typecheck: (observe that the types and body are the same; the node just needs a few extra wrapper lines)
function testFunction(paramGen: Gen(Normal), paramNormal: Normal): Gen(Normal) {

  del(paramNormal) // <- I fail to unify types -- left: Normal | right: Normal Gen
  let variable = passGen(paramGen)

  return variable
}

Link to playground

Diamond imports don't seem to work correctly?

Description: Splitting a file into multiple files that import each other ends up breaking rule-s despite the project executing. It looks as if the different files are referring to the same types but to different node definitions, and hence the net never matches anything in order to start executing -- but it might be something else instead.

To reproduce: In the linked Gist, uncomment all the import lines and comment all the require lines. Despite everything parsing and executing, for some odd reason, rule-s won't match. I have not yet tried to debug the issue further, but I am going to guess that either the fact that I have "diamond" dependencies between files (A depends on B and C that both depend on D) manages to break the import system.

Issue found while developing https://gist.github.com/bojidar-bg/6c52d1f1ed3fb3a583aaff9a184687fe

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.