You can pretty much look at the Java8 streams source (from OpenJDK) and port it to Go. It would need to use interface{} or reflect - the former probably being faster, but both wouldn’t have the type safety - but I think the code would translate pretty easily. Still with IntStream, etc. you could get some of the the type safety back.
https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html > On Nov 12, 2018, at 5:51 PM, Bakul Shah <ba...@bitblocks.com> wrote: > > > >> On Nov 12, 2018, at 9:53 AM, ivan.corra...@bbva.com wrote: >> >> Hey Bakul again, >> >> I've been having a look at kona, and the project looks so good, I will look >> in deep trying to get some good ideas as you recommend me, > > Let me know (off-list) if you need help in deciphering things in kona. > >> In regards to the code generation, I've never done to be honest, but >> obviously the performance should be better. By the way, @Marko_Ristin >> created an issue asking for some performance testing. I think I will face >> this issue before considering code generation. But in case of the >> performance wasn't good at all, for sure that I consider your suggestion >> about generate the code > > Yes, this may not simple.... > >> And, what you mean when say "arbitrary streams (e.g. something built on top >> of channels)?" Sorry for my bad understanding, Thanks in advance > > To me a "stream" can be arbitrarily long and may grow while you are > operating on it. For example C's stdin, stdout etc. That means you > can't always operate on a "whole" string all at once as you can > with arrays. But many of the functions that operate on arrays are > useful with real streams. For example, a service may be generating > a stream of request log records. You may want to analyze these logs > for a given time period and may be create a graph. E.g. you may > have a pipeline like > > MakeStream(requestLogStream). > StartAt(date1). > EndBy(date2). > GroupBy(requestorIP). > Each(Count). > ... > > Here GroupBy may generate a stream of streams. Note: I am just > sketching the idea; there are many holes here. > > The idea is you can slice and dice these streams in various ways > to make sense of your data. Basically you are building unix like > pipelines but they are typed and you are not constrained by shell > syntax. > > This will be non-trivial but can be a very useful package. > > >> >> El lunes, 12 de noviembre de 2018, 12:17:12 (UTC+1), Bakul Shah escribió: >> On Nov 11, 2018, at 11:27 AM, Iván Corrales Solera <ivan.corra...@gmail.com> >> wrote: >>> >>> Hey guys, last weeks I've been working on Koazee and I just released a very >>> first version Titi, v0.0.1 . >>> >>> Koazee is a golang library inspired in Lazy evaluation and functional >>> programming that provides us a rich set of operations that can be done over >>> arrays. If you like the clean code and the functional programming I am >>> sure you enjoy it! >>> >>> >>> Documentation is hosted http://wesovilabs.com/koazee/ >>> >>> And the full code can be found on Github, >>> https://github.com/wesovilabs/koazee >>> >>> Any feedback or recommendation will be appreciated! >> >> Very nice! I like the clean interface. >> >> Some comments: >> >> - Can this handle arbitrary streams (e.g. something built on top of >> channels)? >> That would make a nice extension! >> - You may wish to look at k3 (open source version @ >> https://github.com/kevinlawler/kona) >> In particular https://github.com/kevinlawler/kona/wiki#verbs >> There are some additional functions (verbs) and higher order functions >> (adverbs) >> that may be of interest and will fit in nicely within your framework. >> PDFs of K 2.0 User and Reference manuals (listed under links) have much >> more detail. >> - May be you can provide another interface that *generates* Go code instead >> of >> executing it! If it can be made to generate more efficient code, devoid of >> reflect. >> >> >> "Este mensaje está dirigido de manera exclusiva a su destinatario y puede >> contener información privada y confidencial. No lo reenvíe, copie o >> distribuya a terceros que no deban conocer su contenido. En caso de haberlo >> recibido por error, rogamos lo notifique al remitente y proceda a su >> borrado, así como al de cualquier documento que pudiera adjuntarse. >> >> Por favor tenga en cuenta que los correos enviados vía Internet no permiten >> garantizar la confidencialidad de los mensajes ni su transmisión de forma >> íntegra. >> >> Las opiniones expresadas en el presente correo pertenecen únicamente al >> remitente y no representan necesariamente la opinión del Grupo BBVA." >> >> "This message is intended exclusively for the adressee and may contain >> privileged and confidential information. Please, do not disseminate, copy or >> distribute it to third parties who should not receive it. In case you have >> received it by mistake, please inform the sender and delete the message and >> attachments from your system. >> >> Please keep in mind that e-mails sent by Internet do not allow to guarantee >> neither the confidentiality or the integrity of the messages sent." >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.