<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,60 +1,56 @@
-Miso.Cons = new Miso.Module({
-  initialise: function(car, cdr) {
-    car = typeof car == 'undefined' ? null : car;
-    cdr = typeof cdr == 'undefined' ? null : cdr;
-    
-    if (car == null &amp;&amp; cdr == null) {
-      this.head = null;
-      this.tail = null;
-    } else if (car != null &amp;&amp; cdr == null) {
-      this.head = car;
-      this.tail = new Miso.Cons(null, null);
-    } else {
-      this.head = car;
+Miso.List = function() {};
+
+Miso.List.Nil = {head: null, tail: null};
+
+Miso.List.Cons = function(car, cdr) {
+  var Nil = Miso.List.Nil, cell;
+  
+  if (arguments.length == 2)
+    cell = {head: car, tail: cdr};
+  else if (arguments.length == 1)
+    cell = {head: car, tail: Nil};
+  else
+    cell = Nil;
+  
+  Miso.extend(cell, {
+    toString: function(init) {
+      init = init == null || init == undefined ? '' : init;
       
-      if (cdr instanceof Miso.Cons) {
-        this.tail = new Miso.Cons(cdr.head, cdr.tail);
-      } else {
-        this.tail = new Miso.Cons(cdr, null);
+      if (this.head != null) {
+        var car = this.head.toString();
+        init = init.length &gt; 0
+          ? init + ',' + car
+          : car;
       }
+      
+      return this.tail == null
+        ? '[' + init + ']'
+        : this.tail.toString(init);
     }
-  },
+  });
   
-  toString: function(init) {
-    init = init == null ? '' : init;
-    
-    if (this.head != null) {
-      var car = this.head.toString();
-      init = init.length &gt; 0
-        ? init + ',' + car
-        : car;
+  return cell;
+};
+
+Miso.extend(Miso.List, {
+    construct: function() {
+      var args = (arguments[0] instanceof Array)
+               ? arguments[0]
+               : Array.prototype.slice.call(arguments);
+      
+      var i    = args.length,
+          cell = Miso.List.Nil;
+      
+      while (i--)
+        cell = Miso.List.Cons(args[i], cell);
+      
+      return cell;
     }
-    
-    return this.tail == null
-      ? '[' + init + ']'
-      : this.tail.toString(init);
-  }
 });
 
-Miso.List = {
-  construct: function() {
-    var args = (arguments[0] instanceof Array)
-             ? arguments[0]
-             : Array.prototype.slice.call(arguments);
-    
-    var i    = args.length,
-        cell = null;
-    
-    while (i--)
-      cell = new Miso.Cons(args[i], cell);
-    
-    return cell;
-  }
-};
-
 Miso.extend(Miso.List, {
   empty: function(list) {
-    return list.head == null &amp;&amp; list.tail == null;
+    return list == Miso.List.Nil;
   },
   
   singleton: function(list) {
@@ -72,13 +68,9 @@ Miso.extend(Miso.List, {
   },
   
   foldl: function(fn, base, list) {
-    var lgo = function(z, xs) {
-      return Miso.List.empty(xs)
-        ? z
-        : lgo(fn(z, xs.head), xs.tail);
-    };
-    
-    return lgo(base, list);
+    return Miso.List.empty(list)
+      ? base
+      : arguments.callee(fn, fn(base, list.head), list.tail);
   },
   
   len: function(list) {</diff>
      <filename>src/list.js</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,10 @@
 var ListTest = new JS.Class('ListTest', JS.Test.Unit.TestCase, {
   setup: function() {
     this.oneToFive = Miso.List.construct(1,2,3,4,5);
-    this.oneToTwo  = new Miso.Cons(1,2);
-    this.empty     = new Miso.Cons();
-    this.solo      = new Miso.Cons(1);
-    this.zero      = new Miso.Cons(0);
+    this.oneToTwo  = Miso.List.construct(1,2);
+    this.empty     = Miso.List.Cons();
+    this.solo      = Miso.List.Cons(1);
+    this.zero      = Miso.List.Cons(0);
   },
   
   testCreation: function() {
@@ -15,8 +15,8 @@ var ListTest = new JS.Class('ListTest', JS.Test.Unit.TestCase, {
     this.assertEqual('[]', this.empty);
     this.assertEqual('[0]', this.zero);
     this.assertEqual('[1]', this.solo);
-    this.assertEqual('[1,2]', this.oneToTwo.toString());
-    this.assertEqual('[1,2,3,4,5]', this.oneToFive.toString());
+    this.assertEqual('[1,2]', this.oneToTwo);
+    this.assertEqual('[1,2,3,4,5]', this.oneToFive);
   },
   
   testEmptiness: function() {</diff>
      <filename>test/list_test.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>2ab5972f7da89d6c76d4f48e0cdffd8743f34dd8</id>
    </parent>
  </parents>
  <author>
    <name>Benedict Eastaugh</name>
    <email>benedict@eastaugh.net</email>
  </author>
  <url>http://github.com/ionfish/miso/commit/dac1800e460e9225bd4151c191edc59e2148946d</url>
  <id>dac1800e460e9225bd4151c191edc59e2148946d</id>
  <committed-date>2009-10-06T05:25:00-07:00</committed-date>
  <authored-date>2009-10-06T05:25:00-07:00</authored-date>
  <message>Rewrite Miso.List.</message>
  <tree>2fda890f401f7ec69a13a052d427c5512a7c6351</tree>
  <committer>
    <name>Benedict Eastaugh</name>
    <email>benedict@eastaugh.net</email>
  </committer>
</commit>
