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 <xav...@gmail.com 
> <javascript:>> 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 "configure" a 
> function. I.e., the function is defined as 
>
> let f conf x = ...
>
> where 'f' is the function name, 'conf' a parameter of configuration and 
> 'x' the "real" argument to the function. Now, partial application such a (f 
> c) for some configuration 'c', yields another function which has been 
> configured, or specialized, to the particular use case.
>
> Usually it allows you to define a generic function and then specialize it 
> in some context by "plugging in" a configuration. The configuration is 
> often a constant value which means the compiler will typically 
> constant-propagate that value into the closure. Many functional compilers 
> understand that closures with static data can be eliminated at compile time 
> by replacing them with a normal function. In other words, you have a 
> generic variant of your function, but when run it is specialized and 
> instantiated into an optimized variant.
>
> You *can* get the same with a function such as 'f(conf, x)' but in this 
> case, the compiler usually has some more work to do before it can apply the 
> above transformation.
>
>
>
> -- 
> J.
>

-- 
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