On Thursday, August 16, 2018 at 11:59:00 AM UTC+3, Axel Wagner wrote:
>
> func either(c bool, a, b func() string) string {
> if c {
> return a()
> }
> return b()
> }
>
> func thunk(s string) func() string {
> return func() string { return s }
> }
>
> fmt.Printf("color is %s", either(temperature > 100, thunk("red"),
> thunk("blue"))
>
> </troll> ;)
>
I know you are trolling and don't actually write such code, but for those
who don't notice: if thunk() had side-effects, you would be in trouble.
--
Giulio
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.