Functional programming in D and some reflexion on the () optionality.

Graham Fawcett fawcett at uwindsor.ca
Wed Aug 8 12:24:53 PDT 2012


On Tuesday, 7 August 2012 at 18:36:28 UTC, deadalnix wrote:
>
> The problem isn't about following haskell precisely or not (I 
> think
> we shouldn't). The problem is wanting to have everything, and
> resulting in getting nothing.
>
> Let's take haskell as example. Function are all pure. So it 
> doesn't
> matter when a function get executed or not, and, as a result,
> haskell don't need a explicit function call like () in D.

That's not a good example. Haskell may not use parentheses for
function parameters, but that has nothing to do with purity, or 
even
with non-strict evaluation. It's because, syntactically, 
concatenation
in Haskell represents function application. The Haskell 
expression:

   f x y z

is equivalent to the Haskell expression:

   (((f x) y) z)

translated into D syntax:

   ((f(x))(y))(z),  or just f(x)(y)(z).

Graham



More information about the Digitalmars-d mailing list