I just realized what d be awesome is that the language does not only provide boiler plate []basicType enhanced types, but provides streamed version of them, that d be much better.
when you do [15Million]string.map().filter().count(). with a naive implementation over array of those intents, you effectively end up with a copy at each stage, which is not cool. Instead if that d be a stream api, that d be almost same call, with small changes to be determined, but a much better allocation, as each item is processed once by each function, one item at a time, you don t need the intermediate (stupid, after all) arrays. [15Million]string.map().filter().count(). The difference being that some func call must become terminal, count() int some must probably become contiguous to <something to be decided by the user>, filter() stream can this help to reduce over multiple goroutine? something like ? [15Million]string.chunks(size int, concurrent int).Parrallel(receiver []string{}.filter() stream).count(). count is sequential, it receives results from // filters, receiver is a worker space (memory+work) aka what a stream ? a []string ?, so ParrallelChunk is (input stream/[]string) stream/[]string why not ? On Tuesday, May 30, 2017 at 4:43:54 PM UTC+2, mhh...@gmail.com wrote: > > I m just gonna add more examples as it come, > > from > hasPrefix := func(prefix string) func(string) bool { > return func(s string) bool { return strings.HasPrefix(s, > prefix) } > } // this is not cool.... > > if fnUtils.AllTypes().Filter(hasPrefix("post")).NotEmpty() { > ... > } > > to > hasPrefix, _ := conv(func(prefix string) func(s string) bool, > strings.HasPrefix) > // does this make sense given > https://golang.org/pkg/strings/#HasPrefix ? > > if fnUtils.AllTypes().Filter(hasPrefix("post")).NotEmpty() { > ... > } > > On Friday, May 26, 2017 at 2:47:45 PM UTC+2, mhh...@gmail.com wrote: >> >> oops... mistake in it. >> >> >> printS, err := conv(func(s string, err error), fmt.Println) or panic(err) >> _, err := []string{"hello}.Map(strings. >> ToUpper).MustEach(printS) or panic(err) >> >> count, err := conv(func(s string) n int, fmt.Println) or panic(err) >> n := []string{"hello}.Map(strings.ToUpper).Sum(count) >> >> count, err := conv(func(s string) (n int, err error), fmt.Println) or >> panic(err) >> n, err := []string{"hello}.Map(strings.ToUpper).MustSum(count) or >> panic(err) >> >> more like this, take advantage of return type and names to do more >> conversion. >> >> On Friday, May 26, 2017 at 2:45:33 PM UTC+2, mhh...@gmail.com wrote: >>> >>> or this, >>> >>> printS, err := conv(func(s string, err error), fmt.Println) or panic(err) >>> _, err := []string{"hello}.Map(strings.ToUpper).MustEach(printS) or >>> panic(err) >>> >>> count, err := conv(func(n int), fmt.Println) or panic(err) >>> n := []string{"hello}.Map(strings.ToUpper).Sum(count) >>> >>> count, err := conv(func(n int, err error), fmt.Println) or panic(err) >>> n, err := []string{"hello}.Map(strings.ToUpper).MustSum(count) or >>> panic(err) >>> >>> that'd be great... >>> >>> On Friday, May 26, 2017 at 2:25:37 PM UTC+2, mhh...@gmail.com wrote: >>>> >>>> for the fun, >>>> >>>> I want to write >>>> []string{"hello}.Map(strings.ToUpper).Each(fmt.Println) >>>> >>>> would not work, func param are incompatible. >>>> >>>> let s apply static rules to convert it, >>>> >>>> printS, err := conv(func(s string), fmt.Println) or panic(err) >>>> []string{"hello}.Map(strings.ToUpper).Each(printS) >>>> >>>> Now it s possible. >>>> >>>> And if one does a fmt.MustPrintln to get ride of the error while still >>>> handling it (recoverable) >>>> rather than ignore it as of today, >>>> you can write that, and handle error via recover, >>>> or simply ignore it as in the previous ex. >>>> >>>> printS, err := conv(func(s string), fmt.MustPrintln) or panic(err) >>>> >>>> []string{"hello}.Map(strings.ToUpper).Each(printS) >>>> >>>> >>>> >>>> On Wednesday, May 24, 2017 at 9:52:27 AM UTC+2, mhh...@gmail.com wrote: >>>>> >>>>> see the title, only for what s needed >>>>> Slice/Splice/Each/Map/First/Last/Reverse/Sort ect ect not len, for >>>>> reason. >>>>> so interface system serves the userland by its definition of struct, and >>>>> the basic slice type provided by the language is fully operational, >>>>> without >>>>> breaking, btw. i don t go further in evaluation, i leave that to the >>>>> reader, just trying to work decently. >>>>> >>>> -- 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.