 class Sequence
   constructor: (src) ->
     if not src?
-      throw new Error('use null for the empty sequence')
+      @first = ->
+      @rest  = -> null
     else if typeof src.sequence == 'function'
       seq = src.sequence()
       @first = -> seq.first()

      @first = -> src[0]
      @rest  = -> partial(1)
    else
      throw new Error('cannot make a sequence from #{src}')

  @conj: (first, rest = (-> null), mode = null) ->
    r = rest() if mode == 'forced'


  @::S = this

  make = (seq) ->
    if seq and (res = new Sequence(seq)) and typeof res.first() != 'undefined'
      res
    else
      null

  @memo: (name, f) ->
    @[name]        = (seq) -> f.call(this, make(seq))
