/* vim:set ts=2 sw=2 sts=2 expandtab */
/*jshint asi: true undef: true es5: true node: true browser: true devel: true
         forin: true latedef: false globalstrict: true */
'use strict';

var Method = require('method')

var count = Method()
exports.count = count

var first = Method()
exports.first = first

var rest = Method()
exports.rest = rest

var make = Method()
exports.make = make

var isEmpty = Method(function(sequence) {
  return count(sequence) === 0
})
exports.isEmpty = isEmpty

function cons(head, tail) {
  return make(tail, head)
}
exports.cons = cons

function next(source) {
  return rest(source)
}
exports.next = next

function second(source) {
  return first(rest(source))
}
exports.second = second

function third(source) {
  return first(rest(rest(source)))
}
exports.third = third

@@ -489,16 +489,461 @@
 sEmpty%0A%0A
+make.define(null, function(_, head) %7B return %5Bhead%5D %7D)%0Acount.define(null, function() %7B return 0 %7D)%0Afirst.define(null, function() %7B return null %7D)%0Arest.define(null, function() %7B return %5B%5D %7D)%0A%0Amake.define(Array, function(tail, head) %7B return %5B head %5D.concat(tail) %7D)%0Acount.define(Array, function(array) %7B return array.length %7D)%0Afirst.define(Array, function(array) %7B return array%5B0%5D %7D)%0Arest.define(Array, function(array) %7B return array.slice(1) %7D)%0A
 function

Define default sequence polymorphic methods for Array and null.