0.2.0 • Published 10 years ago

sigsolve v0.2.0

Weekly downloads
6
License
-
Repository
github
Last release
10 years ago

sigsolve

find a path through a type signature pool

testling badge

build status

example

var sigsolve = require('sigsolve');
var pool = {
    f : [ 'a', 'b' ],
    g : [ 'b', 'x' ],
    h : [ 'x', 'z' ],
    i : [ 'c', 'z' ],
    j : [ 'c', 'd' ],
};

var solutions = sigsolve([ 'a', 'z' ], pool);
console.dir(solutions);

output:

[ [ 'f', 'g', 'h' ] ]

or higher-order signatures work too:

var sigsolve = require('sigsolve');
var pool = {
    f : [ [ 'a', 'b' ], 'c' ],
    g : [ 'c', 'z' ],
    h : [ 'a', 'd' ],
    i : [ 'd', 'b' ],
};
var solutions = sigsolve([ 'a', 'z' ], pool);
console.log(JSON.stringify(solutions));

output:

[[["f",["h","i"]],"g"]]

methods

var sigsolve = require('sigsolve')

var solutions = sigsolve(target, pool)

Given a type signature target and an object pool mapping function names to type signatures,

return an array of function chain arrays that when composed have the same type signature as the target.

license

MIT

0.2.0

10 years ago

0.1.0

12 years ago

0.0.0

12 years ago