|
|
|
|
|
by suzuki
2904 days ago
|
|
Thank you.
I appreciated especially the pattern matching feature of C# 7 while programming the interpreter.
For example: /// <summary>Evaluate a Lisp expression in an environment.</summary>
public object Eval(object x, Cell env) {
try {
for (;;) {
switch (x) {
case Arg xarg:
return xarg.GetValue(env);
case Sym xsym:
try {
return Globals[xsym];
} catch (KeyNotFoundException) {
throw new EvalException("void variable", x);
}
case Cell xcell:
|
|