 # --------------------------------------------------------------------
 
 if module? and not module.parent
-  # Test code goes here
-  null
+  console.log seq.interleave([1..3], [9..7], ['a', 'b', 'c']).into []

method 'max', (s) -> @fold__ s, (a,b) -> if b > a then b else a
method 'min', (s) -> @fold__ s, (a,b) -> if b < a then b else a

method 'add', (s, args...) -> combine ((a, b) -> a + b), s, args...
method 'sub', (s, args...) -> combine ((a, b) -> a - b), s, args...
method 'mul', (s, args...) -> combine ((a, b) -> a * b), s, args...
method 'div', (s, args...) -> combine ((a, b) -> a / b), s, args...

method 'equals', (s, args...) ->
  @forall__ seq.zip(s, args...), (t) ->

  Sequence::[name] = (args...)    -> f.call(seq, this,   args...)

seq.combinator = combinator = (name, f) ->
  seq[name] = (args...) ->
    seq.fold seq.map(args, seq), (s, t) -> f.call(seq, s, t)

  seq["#{name}__"] = (s, t)    -> f.call(seq, s, t)
  Sequence::[name] = (args...) -> seq[name] this, args...

seq.zip__ = (seqs) ->
  firsts = seqs?.map (s) -> if s? then s.first() else null
