Re: [go-nuts] Re: Currying in Go

2016-06-20 Thread Tyler Compton
Thank you, Jesper, that's very interesting. On Sunday, June 19, 2016 at 8:15:13 AM UTC-7, Jesper Louis Andersen wrote: > > > On Sat, Jun 18, 2016 at 5:32 AM, Tyler Compton > wrote: > >> I don't pretend to be proficient in this realm of functional programming, >> but I would be very surprised if

Re: [go-nuts] Re: Currying in Go

2016-06-19 Thread Jesper Louis Andersen
On Sat, Jun 18, 2016 at 5:32 AM, Tyler Compton wrote: > I don't pretend to be proficient in this realm of functional programming, > but I would be very surprised if this is valuable in a language like Go > that can and does hold state. In functional languages, it is often used as a way to "conf

[go-nuts] Re: Currying in Go

2016-06-19 Thread Christoph Berger
> this seems like an eyesore and maintenance concern. (...) it does cause me to hear code review sirens going off in the distance. Then why would you want to use currying in Go at all? What's the point of being able to write f(1)(2)(3) instead of f(1,2,3) *in a non-functional language?* Especi

[go-nuts] Re: Currying in Go

2016-06-17 Thread Tyler Compton
I would also like to hear from somebody about a real world use-case. I don't pretend to be proficient in this realm of functional programming, but I would be very surprised if this is valuable in a language like Go that can and does hold state. That said, this is very cool and I would love to b

Re: [go-nuts] Re: Currying in Go

2016-06-17 Thread Ian Lance Taylor
Note that Go's reflect package is powerful enough to implement currying directly, though you do have to convert back to the expected type in order to call the function. https://play.golang.org/p/2ukRfHGnlT Ian -- You received this message because you are subscribed to the Google Groups "golang

[go-nuts] Re: Currying in Go

2016-06-17 Thread Evan Digby
Currying is translating the evaluation of a function with multiple arguments into evaluating a sequence of functions with one argument. Not sure how this doesn't qualify, even if a closure was used to accomplish this. As for the value, at the very least there is the same value as using closures

[go-nuts] Re: Currying in Go

2016-06-17 Thread paraiso . marc
What is the point of doing that in a language that doesn't support auto currying ? There is none. You are not currying anything by the way, you just wrote 3 closures. Le vendredi 17 juin 2016 00:00:43 UTC+2, Zauberkraut a écrit : > > Hello, > > Go enables the evaluation of functions using curry

Re: [go-nuts] Re: Currying in Go

2016-06-16 Thread evan . digby
I played around tonight trying to come up with a better way, but instead I came up with 2 decidedly worse ways (particularly considering readability/maintenance is the primary concern of the question). I think they're novel enough to share! https://play.golang.org/p/w9YxsEFlF8 1) Original 2)

Re: [go-nuts] Re: Currying in Go

2016-06-16 Thread Patrick Logan
Go allows functions to have multiple arguments. The upside is currying is much less necessary in languages like Go. The downside is combining one-argument functions to make new one-argument functions is syntactically more cumbersome. -- You received this message because you are subscribed to

Re: [go-nuts] Re: Currying in Go

2016-06-16 Thread Henrik Johansson
Note the _excessive_ caveat. Used with some restraint I think it is a very powerful construct. On Fri, Jun 17, 2016, 03:42 adonovan via golang-nuts < golang-nuts@googlegroups.com> wrote: > On Thursday, 16 June 2016 18:00:43 UTC-4, Zauberkraut wrote: >> >> would an extended usage of this paradigm

[go-nuts] Re: Currying in Go

2016-06-16 Thread adonovan via golang-nuts
On Thursday, 16 June 2016 18:00:43 UTC-4, Zauberkraut wrote: > > would an extended usage of this paradigm be considered unidiomatic in Go? > Short answer: yes. Excessive use of function values as arguments and results of other functions can make the flow of control hard to follow. -- You recei