[nem-en] Macro proposal
Kamil Skalski
kamil.skalski at gmail.com
Tue Jun 19 23:19:29 CEST 2007
Ah, so actually <| would be equivalent to function application... just like
f (1,a, _) ( fun () {
} )
e.g.
public static @<| (f : 'a -> 'b, obj : 'a) : 'b {
f (obj)
}
So, right, this should be possible too. What macro could do here is to
transform the right hand side from expression to lambda, so you could
write
f (1,a) <| 3
and it would be transformed into
f (1, a, fun () { 3 })
which probably would bring us even closer to Ruby blocks ;)
f(1,a) <| {
foo ()
}
>
> The operator <| can be defined as binary operator taking a function on
> the left and an arbitrary object on the right. This would be symetrical
> to the |> operator defined in lib/internal-numbered.n.
>
> public static @|> (a : 'p1, fac : 'p1 -> 'r) : 'r
> {
> fac(a)
> }
>
> -- Kamil Dworakowski
>
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>
--
Kamil Skalski
http://nazgul.omega.pl
More information about the devel-en
mailing list