Newbie comments and suggestions
- Posted by Jeremy <jeremydunn at comcast.net> Jul 27, 2005
- 491 views
I've recently discovered Euphoria and like it very much. Having programmed in LISP quite a bit I naturally like any language that has some of its best features. I thought I would share some syntax suggestions for people to consider and comment on 1. Nesting of functions Suppose we have sin(log(abs(x))) where we have several nested functions. I would like to be able to write a nested expression like this as sin_log_abs(x) and get rid of some parentheses. This could be added without breaking previous code and would better show the logic. 2. Add function equivalents of the operators What I mean by this is to allow the user to write A * B as mul(A, B) if they so desire. Yes the user could write a function to do this but Euphoria does not allow functions with unlimited arguments unless passed as a sequence. Mathematica does this, and combined with the previous syntax suggestion can result in more compressed and elegant expressions for those of us looking for greater brevity and consistency in our notation. 3. Allow parsing and collection of arguments Suppose we have sin(x) + sin(y) + sin(z) . I would like to be able to write this as add_sin(x|y|z) where we nest our functions and the pipe character is used to parse the arguments of the function that we are mapping a function to. Here is how it would work with a function that handles two arguments: we could write a/b + c/d + e/f as add_div(a, b| c, d| e, f). In this case it is not particularly briefer but in other expressions where we have functions it would be simpler. Again these suggestions would not break any existing code but would make the language even simpler and more powerful.