 # XREGEXP                   = require 'xregexp'
 PS                        = require 'pipestreams'
 { $, $async, }            = PS
-new_pushable              = require 'pull-pushable'
 assign                    = Object.assign
 jr                        = JSON.stringify
 copy                      = ( P... ) -> assign {}, P...
 rprx                      = ( d ) -> "#{d.mark} #{d.type}:: #{jr d.value} #{jr d.stamped ? false}"
+# echo '{ ' + ( ( name for name of require './recycle' ).sort().join '\n  ' ) + " } = require './recycle'"
+{ $recycle
+  $unwrap_recycled
+  is_recycling
+  is_stamped
+  is_system
+  new_end_event
+  new_event
+  new_single_event
+  new_start_event
+  new_stop_event
+  new_system_event
+  new_text_event
+  new_push_source
+  new_warning
+  recycling
+  select
+  select_all
+  stamp
+  unwrap_recycled } = require './recycle'
 
 #-----------------------------------------------------------------------------------------------------------
 @active_chr_pattern   = /// ///u

# @add_active_chr '-'; help @active_chr_pattern
# @add_active_chr '^'; help @active_chr_pattern

#-----------------------------------------------------------------------------------------------------------
@f = ( S ) ->
  S.source    = new_pushable()
  on_stop     = PS.new_event_collector 'stop', -> help 'ok'
  pipeline    = []
  #.........................................................................................................
  pipeline.push S.source
  pipeline.push $uncycle()
  # pipeline.push COLLATZ.$main S
  pipeline.push PS.$watch ( d ) -> help '> sink  ', rprx d unless is_meta d
  #.........................................................................................................
  pipeline.push PS.$watch ( d ) -> if ( select d, '~', 'end' ) then S.source.end()
  pipeline.push $try_to_recycle S.source.push.bind S.source
  #.........................................................................................................
  pipeline.push on_stop.add PS.$drain()
  PS.pull pipeline...
  #.........................................................................................................
  R       = ( value ) -> S.source.push new_event '.', 'number', value
  R.end   = -> S.source.end()
  return R


    unless ( CND.isa_text chr ) and ( chr.match /^.$/u )?
      throw new Error "expected single character, got #{rpr chr}"
    @active_chrs.add chr
  achrs                 = ( ( @_escape_for_regex chr ) for chr from @active_chrs ).join '|'
  @active_chr_pattern   = /// ^ (?<left> .*? ) (?<achrs> (?<achr> #{achrs} ) \k<achr>* ) (?<right> .* ) $ ///
                        # /// (?<!\\) (?<achr> (?<chr> [ \* ` + p ] ) \k<chr>* ) ///
  return null

#-----------------------------------------------------------------------------------------------------------
@add_active_chrs '<', '&', '*', '`', '^', '_', '𣥒'
# help @active_chr_pattern

# debug @_escape_for_regex '*'
# debug @_escape_for_regex '/'
