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.

Reply via email to