 var and_ = function (x, xs) {
   return {
     head: x,
-    tail: xs,
-    size: function() {
-      return 1 + this.tail.size();
-    }
+    tail: xs
   };
+}
+
+var $listSize = function (list) {
+  if (list.length == 0) {
+    return 0;
+  }
+  return 1 + $listSize(list.tail);
 }
 
 var showminus_list = function (x) {


compileMap = (elems) ->
  [constr, args...] = elems
  "({\"#{constr.token}\": [#{args.map(compileImpl).join ', '}]})"

expandMacro = (macro) ->
  macros[macro]?() ? macro

    else
      "function(__a, __b){return #{to}(__a, __b);}"

invertedBinaryFnMapping =
  from: '^'.split ' '
  to: 'Math.pow'.split ' '

expandBuiltings invertedBinaryFnMapping, (to) ->
  (x, y) ->
    if x and y
      "#{to}(#{y}, #{x})"
    else if x
      "function(__b){return #{to}(__b, #{a});}"
    else
      "function(__a, __b){return #{to}(__b, __a);}"

binaryOpMapping =
  from: '+ * = != and or'.split ' '
  to: '+ * == != && ||'.split ' '

expandBuiltings binaryOpMapping, (to) ->
  (x, y) ->
