Syntactical sugar for string templates and lambdas?

via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 26 04:20:49 PDT 2014


On Tuesday, 26 August 2014 at 10:10:07 UTC, Ola Fosheim Grøstad 
wrote:
> IN:
> (int`x + int`y) * `y
>
> OUT:
> (int __1,int __2) => (__1 + __2) * __2


And in case anyone wonders, I was thinking that perhaps the order 
of the parameters could be lexical, so you get the transforms:

IN:
int`y < int`x

OUT:
(int x, int y) => y<x


IN:
int`y + func( `(int`b + `x)  ) * int`x

OUT:
(int x,int y) => y + func(  (int b)=> b+x ) + x


Or if the contexts impose signatures that can be used for type 
deduction:

IN:
`y < `x

OUT:
(x,y) => y<x


IN:
`y + func( `b + `x ) * `x

OUT:
(x,y) => y + func(  (b)=> b+x ) + x



More information about the Digitalmars-d mailing list