I've now added a class for Streamable containers.
This is just a container type with an iterator method which in turn
can be used to produced a stream of values.

The library is modified so the iterators for arrays, lists, strings,
and re2 are now instances. This allows one to write a function which
can accept any Streamable data structures as an argument and
proceed to process the stream of values. This saves the user
applying the iterator method to the container.

For example:

  //$ Schannel multiplexor based on iterator argument.
  //$ Accepts stream of input schannels.
  //$ Writes to output schannel.
  proc mux[T] (inp:1->opt[ischannel[T]], out:oschannel[T]) ()
  {
    for i in inp do 
      spawn_fthread$ copy(i,out); 
    done 
  }


  //$ Schannel multiplexor based on streamable data structure.
  //$ Creates stream of input schannels.
  //$ Writes to output schannel.
  fun mux[C,T with Streamable[C,ischannel[T]]] (a:C, out:oschannel[T]) =>
    mux (iterator a, out)
  ;
}

here I defined a channel multiplexor accepting an iterator
which is used to procure the input channel set.
This has to be called by 

        mux ( iterator (i1, i2) , o )


If you had a list lc of channels:

        mux (iterator lc, o)

The second function just accepts a streamable container instead
and calls the iterator function for you, so you can write:

        mux ( (i1, i2), o);
        mux (lc, o);

I find this highly amusing! We have gone from using one or two fixed container
types, to a polyadic function using an iterator, then back to a weaker
polymorphic function.

NEW FEATURES RECENTLY ADDED (SUMMARY):

* better diagnostics for inline functions
* (messy) client interface to scheduler
* futures
* pipes
* multiplexors
* streamable class

As the library develops, the features get better integrated.
So if you want a better Felix .. PARTICIPATE!
The library now has around 150 files. I cannot maintain and
document all that alone (as well as work on the compiler,
website, tools, etc).

--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Keep yourself connected to Go Parallel: 
DESIGN Expert tips on starting your parallel project right.
http://goparallel.sourceforge.net/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to