Hi all,
Are there builint operators in Nemerle like |> >> << <| from F#.
They can be built with macros but I like experience.
For example:
macro @|> (e1, e2)
{
<[ $e2($e1) ]>
}
I write:
"a" |> Console.WriteLine
What precedence value should i specify in operator attribute?
How to implement <| which is right associative?
Thanks
You don't even need a macro. |> is already a function in the standard library, defined like this:
public static @|> (a : 'p1, fac : 'p1 -> 'r) : 'r
{
fac(a)
}
public static @|> (a : 'p1, fac : 'p1 -> void) : void
{
fac(a)
}
There are also <<, >>, and <|. You can find them all in
lib/internal-numbered.n.
Здравствуйте, Don Reba, Вы писали:
DR>You don't even need a macro. |> is already a function in the standard library, defined like this:
DR>DR>public static @|> (a : 'p1, fac : 'p1 -> 'r) : 'r
DR>{
DR> fac(a)
DR>}
DR>public static @|> (a : 'p1, fac : 'p1 -> void) : void
DR>{
DR> fac(a)
DR>}
DR>
DR>There are also <<, >>, and <|. You can find them all in lib/internal-numbered.n.
Thank you!