Re: A bug in the interpreter
- Posted by Ricardo M. Forno <rmforno at tutopia.com> Mar 01, 2006
- 463 views
Jason Gade wrote: > > Ricardo M. Forno wrote: > > One of the languages that has something similar is good old COBOL, > > because you may omit the variable name in the second comparison, > > but anyway it uses 'and'. > > Anyway, I think the main issue is this: are there fixed rules for > > the syntax and semantics of mathematical expressions? Newton, > > Leibnitz, Fermat, Euler, Gauss, etc,. all of them used different > > notations. What I was taught at school is now totally different. > > And I see the time coming when mathematical notation will evolve > > from computer programming languages. > > > > Regards. > > It is actually pretty simple. Given parentheses to group operations and the > precedence > of operations, mathematical expressions are evaluated from left to right. No > operator > in Euphoria is trinary; therefore expressions such as 4 < n < 8 are considered > as two binary operations evaluated from left to right. First, 4 < n is > evaluated > then its result, 1 or 0, is compared to < 8. > > Euphoria's precedence is found at <a > href="http://www.rapideuphoria.com/refman_2.htm#2A">http://www.rapideuphoria.com/refman_2.htm#2A</a> > > -- > "Any programming problem can be solved by adding a level of indirection." > --anonymous > "Any performance problem can be solved by removing a level of indirection." > --M. Haertel > "Premature optimization is the root of all evil in programming." > --C.A.R. Hoare > j. Of course, Jason. I know this from the time I first programmed in C and Euphoria. It is really simple. Hovever, simpler than that is APL and J (do not confuse with Java) in which everything is evaluated from right to left, as assignment is evaluated. My concern was not about Euphoria but about math itself. There is no undisputed syntax / semantics for mathematical expressions. So it makes no sense to say, for example, that Euphoria does not follow mathematical conventions, since they are not uniform. For example, in algebra "ax" is usually interpreted as "a times x", and not as a variable named "ax". Also, sometimes a dot was used to mean "times", as in "a.x + c.y". The multiplication operator was a sign resembling "x" and not "*" as in programming languages. There are also a lot of strange symbols for square roots, derivatives, integrals, etc., for which there is no equivalent in computer programming languages. Regards.