<commit_before>define ["parse", "nodes"], (parse, nodes) ->

	# Public interface for nodes.

	class Expression
		constructor: (val) ->
			if val instanceof String or typeof val == "string"
				# The string we pass in is just a representation to parse.
				@expr = parse.stringToExpression(val)
			else if val.copy?
				@expr = val.copy()
			else
				throw new Error("Unknown argument: `#{val}'.")

		toString: ->
			@expr.toString()

		toMathML: ->
			@expr.toMathML()

		toLaTeX: ->
			@expr.toLaTeX()

		solve: (variable) ->
			# TODO: Equivalencies.
			new Expression(@expr.solve(variable))

		sub: (substitutions) ->
			# TODO: Uncertainties, equivalencies, options.
			# TODO: Seems that the way I implemented substituting expressions was different last time for no real reason. Fix.
<commit_msg>Fixed a bug in Expression solving.<commit_after>define ["parse", "nodes"], (parse, nodes) ->

	# Public interface for nodes.

	class Expression
		constructor: (val) ->
			if val instanceof String or typeof val == "string"
				# The string we pass in is just a representation to parse.
				@expr = parse.stringToExpression(val)
			else if val.copy?
				@expr = val.copy()
			else
				console.log("Received argument: ", val)
				throw new Error("Unknown argument: `#{val}'.")

		toString: ->
			@expr.toString()

		toMathML: ->
			@expr.toMathML()

		toLaTeX: ->
			@expr.toLaTeX()

		solve: (variable) ->
			# TODO: Equivalencies.
			(new Expression(solution) for solution in @expr.solve(variable))

		sub: (substitutions) ->
			# TODO: Uncertainties, equivalencies, options.
			# TODO: Seems that the way I implemented substituting expressions was different last time for no real reason. Fix.

{'fraction_non_alphanumeric': 0.12514757969303425, 'fraction_numerical': 0.0, 'mean_word_length': 3.368556701030928, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '6518983', 'n_tokens_mistral': 611, 'n_tokens_neox': 504, 'n_words': 174}