demo/generators.js
function tree(list) {
  var n = list.length;
  if (n == 0) {
    return null;
  }
  var i = Math.floor(n / 2);
  return new Tree(list[i], tree(list.slice(0, i)), tree(list.slice(i + 1)));
}
function tree(list) {
  var n = list.length;
  if (n == 0) {
    return null;
  }
  var i = Math.floor(n / 2);
  return new Tree(list[i], tree(list.slice(0, i)), tree(list.slice(i + 1)));
}
function tree ( list ) { var n = list . length ; if ( n == 0 ) { return null ; } var i = Math . floor ( n / 2 ) ; return new Tree ( list [ i ] , tree ( list . slice ( 0 , i ) ) , tree ( list . slice ( i + 1 ) ) ) ; }
Create a Tree from a list.
Create a Tree from a list .