Skip to main content
8 events
when toggle format what by license comment
Sep 27, 2015 at 16:11 comment added Jules @jco in a pure functional environment, particularly once that (like Haskell) supports lazy evaluation, there is no real difference between a function of no arguments returning T and a value of type T. Either can be used in the same context, and may (or may not) result in further calculation being performed. In an impure environment, things are different: there may be side effects, or dependencies on the environment that may change during execution. Comparing mechanisms from the two does not necessarily yield useful results.
Jul 12, 2015 at 16:54 comment added jcora @Telastyn I'm not sure what's your point? I'm rather sure that you can't 'bind' like this in Haskell either -- as binding the last argument means executing the function.
Jul 12, 2015 at 16:52 comment added Telastyn @jco - sure, it would be simple, but it is still a special case of binding.
Jul 12, 2015 at 16:42 comment added jcora @Telastyn My language is not pure, and these parameterless functions would actually be used frequently (time, random, printNewline, etc). However, I'm not really buying your binding argument -- it would be simple to bind an argument to a unary function by using a lambda expression that transforms it into this "unit-accepting" function.
Jul 12, 2015 at 7:47 comment added user7043 I see. But with this function call syntax, a better option is to go all the way with currying. Then no separate function is necessary and it becomes more consistent that binding the only remaining parameter calls the function.
Jul 12, 2015 at 2:52 comment added Telastyn @delnan - I was thinking along the lines of boost::bind in C++ world, where you can say bind(f, x) which returns a nullary function that returns U.
Jul 12, 2015 at 0:54 comment added user7043 I don't quite follow the part about parameter binding. If f is a function T -> U, then f x doesn't just bind a value to the first parameter, it calls the function, because now all arguments are supplied. This is what several functional languages do. In fact, it is the only reasonable course of action that I can imagine with that function call syntax.
Jul 12, 2015 at 0:36 history answered Telastyn CC BY-SA 3.0