Theiling Online    Sitemap    Conlang Mailing List HQ   

Mathematical Notation (Was Re: Tiny lexicon languages)

From:Paul Bennett <pbennett@...>
Date:Saturday, June 19, 1999, 18:54
On 18 Jun 99, at 23:47, Nik Taylor wrote:

> Yeah, but when you get into more complex equations it can be nearly > impossible to describe it in words, such as X+(Y*Z)/(A+B), and that's > not even that complex. >
I may be way off the point here, but there's a very effective mathematical notation already in existence that relies on a simple sequence of tokens to be parsed, that'd fit rather well into a SOV language. It's been around for many many years, it's reasonably well known in computing circles, it's impossible to be ambiguous and it has no need of brackets. It's called Reverse Polish Notation. Exactly how RPN works is hard to describe without getting all technical, but X+((Y*Z)/(A+B)) (assuming that's what you meant) would be: Z Y * B A + / X + For completeness, (X+(Y*Z))/(A+B) would be Z Y * X + B A + / Basically, a value means "append this symbol to the end of a list", and an operator means "remove the last two values from the end of the list, do this to them, and append the value of the result to the end of the list". Obviously, if an operator requires more (or less) than two values, you remove the required number. For operators that are not transparent (like /) you need a rule to say (eg) "of the two values taken, the one nearer the end of the list is the 'second' one in conventional notation". There is scope for "meta-operators" that take values from the list as parameters (ie a "group sum" that takes the last value to be the count of values to add, and then takes that many values from the list (excluding the count), adds them and stores the value back), and operators like "exchange" that swap the last and last-but-one (or last-but-one and last-but-two, etc) values on the list. --- Pb Appology for getting all techy: -----BEGIN GEEK CODE EXTRACT----- GIT/CS$ C++++$ e@ ------END GEEK CODE EXTRACT------