2 using System.Collections.Generic;
9 static MSymbol Mpreedit = MSymbol.Of ("preedit");
11 public static object insert (MExpression[] args, MExpression.Domain domain)
13 MText preedit = (MText) domain.GetValue (Mpreedit);
14 object val = args[0].Val;
17 preedit.Cat ((int) val);
19 preedit.Cat ((MText) val);
23 public static void Main()
25 MExpression.Domain domain = new MExpression.Domain (null);
27 domain.Defun ("insert", insert, 1, 1, false);
28 domain.Bind (MSymbol.Of ("X"), 10);
29 domain.Bind (Mpreedit, new MText ("PREEDIT TEXT"));
32 using (FileStream stream = new FileStream ("eval.txt", FileMode.Open))
34 expr = new MExpression (new MPlist (stream), domain);
36 Console.WriteLine (domain);
38 Console.WriteLine (" => " + expr.Eval (domain));
39 Console.WriteLine (domain);