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

  else
    null

seq.zip = (args...) -> seq.zip__ seq.map args, seq

Sequence::zip = (args...) -> seq.zip this, args...

seq.combine = combine = (op, args...) ->
  seq.zip(args...)?.map (s) -> seq.fold s, op

Sequence::combine = (op, args...) -> combine op, this, args...


method 'empty', (s) -> not s?

  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
