-
For example, we partially applied functions to use them later, but if creating a partial applied function involves some costs, it seems to better to store these values that are computed by writing a function that takes some values and do some computation and use the result of that to create a new function. But this is basically the same as currying, instead of applying one less parameter, you wrote a function that took one less parameter that would return a function that takes one more parameter. Now I am wondering if currying a function would nicely perform 'some computation' when enough arguments are being applied and then use the value of the computations to be applied with further arguments that will be provided, which's smart. Or do I have to do it manually let Procedure a =
let computation = something a
fun b -> another_something computation
let Procedure a b =
let computation = something a
another_something computation Essentially, the first example is the same as the second, but the first example caches the values obviously. Fairly speaking, you can eventually still store the values of any function any where, if eager evaluations are needed for laziness with caching in your application |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
No, you basically get this for a curried version let Procedure a =
fun b ->
let computation = something a
another_something computation You don't enjoy such auto optimizations because of various reasons:
So I don't believe such optimizations can be applied to the current .Net runtime. |
Beta Was this translation helpful? Give feedback.
-
You may be interested in experimenting with what the compiler does on sharplab.io. |
Beta Was this translation helpful? Give feedback.
No, you basically get this for a curried version
You don't enjoy such auto optimizations because of various reasons:
So I don't believe such optimizations can be applied to the …