feat: Add ArithmeticExpressions csproj

This commit is contained in:
John Colvin committed 2023-09-29 12:54:14 -04:00
1 parent e4f276be2a
commit ca95ab7a24
26 files changed
+2465 -1

No files matched your search

@@ -0,0 +1,15 @@
namespace Bts.ArithmeticExpressions;
using System.Collections.Generic;
class Variable : IArithmeticExpression {
readonly string identifier;
public Variable(string identifier) =>
this.identifier = identifier;
public object? Evaluate(IDictionary<string, object?> env) =>
env.TryGetValue(identifier, out var val) ? val :
throw new KeyNotFoundException(
$"Failed to find {nameof(Variable)} '{identifier}'");
}