<commit_before>import Boo.Lang.PatternMatching
import Boo.Adt

data Expression = Const(value as int) | Add(left as Expression, right as Expression)

def eval(e as Expression) as int:
   match e:
      case Const(value):
      	return value
      case Add(left, right):
      	return eval(left) + eval(right)
      
def simplify(e as Expression) as Expression:
	match e:
		case Add(left: Const(value: 0), right):
			return simplify(right)
		case Add(left, right: Const(value: 0)):
			return simplify(left)
		case Add(left, right):
			return Add(simplify(left), simplify(right))
		otherwise:
			return e
      

e = Add(Add(Const(19), Const(0)), Add(Const(0), Const(23)))

print simplify(e)
print eval(e) 
print eval(simplify(e))<commit_msg>minor change to example (Sum reads better than Add)<commit_after>import Boo.Adt
import Boo.Lang.PatternMatching

data Expression = Const(value as int) \
	| Sum(left as Expression, right as Expression)

def eval(e as Expression) as int:
   match e:
      case Const(value):
      	return value
      case Sum(left, right):
      	return eval(left) + eval(right)
      
def simplify(e as Expression) as Expression:
	match e:
		case Sum(left: Const(value: 0), right):
			return simplify(right)
		case Sum(left, right: Const(value: 0)):
			return simplify(left)
		case Sum(left, right):
			return Sum(simplify(left), simplify(right))
		otherwise:
			return e

e = Sum(Sum(Const(19), Const(0)), Sum(Const(0), Const(23)))

print simplify(e)
print eval(e) 
print eval(simplify(e))
{'fraction_non_alphanumeric': 0.12235449735449735, 'fraction_numerical': 0.010582010582010581, 'mean_word_length': 3.960655737704918, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4717008', 'n_tokens_mistral': 543, 'n_tokens_neox': 492, 'n_words': 157}