Use quotation - vilinski/nemerle GitHub Wiki

Use quotation

  • Category: Quotation
  • Description: Basic quotation sample
  • Code (in separate macro library):
using System.Console;

macro test()
{
  def expr  = <[ 1 ]>;
  def expr2 = <[ func(3, 2 * 5) ]>;
  def expr3 = <[ f ]>;
  WriteLine($"expr type is $(expr.GetType())");
  WriteLine($"expr2 type is $(expr2.GetType())");
  WriteLine($"expr3 type is $(expr3.GetType())");
  <[]>
}
  • Code (you must use macro above as reference):
test()
  • Execution Result (in compilation window):
expr type is Nemerle.Compiler.Parsetree.PExpr+Literal
expr2 type is Nemerle.Compiler.Parsetree.PExpr+Call
expr3 type is Nemerle.Compiler.Parsetree.PExpr+Ref

[Copyright ©](Terms of use, legal notice)

⚠️ **GitHub.com Fallback** ⚠️