Permalink
Browse files

readme and example

  • Loading branch information...
0 parents commit 03248997ab5517bfb5bb3924b132a981bd212222 @substack committed Apr 21, 2012
Showing with 60 additions and 0 deletions.
  1. +51 −0 README.markdown
  2. +9 −0 example/where.js
@@ -0,0 +1,51 @@
+disorder
+========
+
+Compute expressions out of order, like `where` or `let` blocks in haskell.
+
+example
+=======
+
+``` js
+var disorder = require('disorder');
+
+var vars = disorder({
+ x : function (y, f, z) { return z * f(y + 1) },
+ y : function (z) { return z * 2 },
+ z : 5,
+ f : function (y) { return function (n) { y * n } },
+});
+console.dir(vars);
+```
+
+methods
+=======
+
+```
+var disorder = require('disorder')
+```
+
+disorder(exprs)
+---------------
+
+Given an object of variable expressions `exprs` that maps names to function
+expressions or constants, return an object that solves the dependency graph, if
+possible.
+
+Each expression can be a constant value or a function to express a dependant
+value. To specify dependencies, use the variable expression name in the
+arguments list.
+
+install
+=======
+
+With [npm](http://npmjs.org) do:
+
+```
+npm install disorder
+```
+
+license
+=======
+
+MIT
@@ -0,0 +1,9 @@
+var disorder = require('../');
+
+var vars = disorder({
+ x : function (y, f, z) { return z * f(y + 1) },
+ y : function (z) { return z * 2 },
+ z : 5,
+ f : function (y) { return function (n) { y * n } },
+});
+console.dir(vars);

0 comments on commit 0324899

Please sign in to comment.