1. Newbie comments and suggestions

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.

new topic     » topic index » view message » categorize

2. Re: Newbie comments and suggestions

Hi Jeremy,

Pretty much all of this can easily be done with a simple library, rather than
adding more, possibly, confusing syntactical changes to the basic language.

The 'nesting of functions' is a very basic example of a do-it-yourself
specialised function (how often do the majority of users use a function such as
sin_log_abs()???).  Much easier to have a library of these shortcuts that you use
and define for your needs.  In general there will always be the need for that one
extra function which isn't built in no matter how many extra function are added
:)

mul(a,b) is, in my opinion, much more confusing than a simple a*b and also much
more to type in the long run.  Why add a funtion to do what a key character
already does?  Mathematica is a language designed for doing mathematical
equations, Euphoria is a generalised language - not really the same thing.  I
agree that the lack of variable arguments does hinder the language flexibility,
but once you are used to that then creating functions that simply loop through a
sequence of values becomes second nature very quickly.

The parsing of arguments via piping can easily be done using the sequence method
from above. Eg:
function sin_list(sequence args)
  object res
    res = 0
    for i=1 to length(args) do
      res += sin(args[i])
    end for
  return res
end function

sin_list({x,y,z})

or

function add_div(sequence args)
  object res
    res = 0
    for i=1 to length(args) do
      res += (args[i][1] / args[i][2])
    end for
  return res
end function

add_div({{a,b},{c,d},{e,f}})


Maybe these are not as easy on the eye as (a,b|c,d|e,f), but I think the
question still remains as to the general use of the proposed ability of | by the
average programmer.

BTW, these are only my opinions on the proposals, as I'm sure that others will
agree or disagree in the following messages. :)

If you can raise 100% support for any of these ideas then you have achieved a 1%
chance of it appearing in the next release of Euphoria :)

Cheers
Dave

Jeremy wrote:
> 
> 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.
> 


. .. : :: = == == = :: : .. .
Server-Side DB driven web sites,
Software Development
(and part-time games developer)

contact dave_p at purpletiger dot com
or probert.dave at gmail dot com
. .. : :: = == == = :: : .. .

new topic     » goto parent     » topic index » view message » categorize

3. Re: Newbie comments and suggestions

Jeremy wrote:
> 
> 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
list of feature requests snipped


While I don't necessarily agree with your list of feature requests I will say as
a person who loves LISP and BASIC that I found Euphoria to be the best language
where I could program in a structured BASIC like syntax and keep the power of
LISP. In fact I was able to write a LISP interpreter in Euphoria pretty easily.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Newbie comments and suggestions

Dave Probert wrote:

[snip]
 
> If you can raise 100% support for any of these ideas then you have achieved a
> 1% chance
> of it appearing in the next release of Euphoria :)

Dave, you are the optimist, aren't you. I would have said "any release of
Euphoria". And 1% seems a bit high to me too.

-- 
Derek Parnell
Melbourne, Australia
Skype name: derek.j.parnell

new topic     » goto parent     » topic index » view message » categorize

5. Re: Newbie comments and suggestions

Hmm,

You're ever the Sarcastic one arn't you :)  I know I should have written
0.000001% chance, but I was being lazy and didn't want to put the Newbie's off
completely :) :)

BTW, I think RDS are going to revoke our access here if we're not more careful
;)

Cheers,

Dave

. .. : :: = == == = :: : .. .
Server-Side DB driven web sites,
Software Development
(and part-time games developer)

contact dave_p at purpletiger dot com
or probert.dave at gmail dot com
. .. : :: = == == = :: : .. .

new topic     » goto parent     » topic index » view message » categorize

6. Re: Newbie comments and suggestions

D. Newhall wrote:

> I was able to write a LISP interpreter in Euphoria pretty easily.

I can't find your LISP interpreter in the archive.

Bernie

My files in archive:
w32engin.ew mixedlib.e eu_engin.e win32eru.exw

Can be downloaded here:
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan

new topic     » goto parent     » topic index » view message » categorize

7. Re: Newbie comments and suggestions

On 27 Jul 2005, at 10:48, Bernie Ryan wrote:

> 
> 
> posted by: Bernie Ryan <xotron at bluefrog.com>
> 
> D. Newhall wrote:
> 
> > I was able to write a LISP interpreter in Euphoria pretty easily.
> 
> I can't find your LISP interpreter in the archive.

Told ya Eu was Lispy 5+ years ago! Now if only Lisp was as easy to use as 
Eu, or if Eu could do as much as Lisp. You know how math operations can 
be done across sequences?, then why can't string operations be done the 
same way? Oh right, can't make a sequence of string types, because there 
aren't any native string types. Opps, off topic again.

Kat

new topic     » goto parent     » topic index » view message » categorize

8. Re: Newbie comments and suggestions

Bernie Ryan wrote:
> 
> D. Newhall wrote:
> 
> > I was able to write a LISP interpreter in Euphoria pretty easily.
> 
> I can't find your LISP interpreter in the archive.
> 
> Bernie
>
Yeah, I haven't released it yet because I need to fix some stuff about defining
recursive functions and other projects have taken precedence (like the
documentation generator for ESL). It's an implementation of LispKit LISP which is
a very strict, purely functional version. It can execute statements like (ADD
(QUOTE 1) (QUOTE 2)) no problem but once you try (LETREC ADD1 (ADD1 LAMBDA (X)
(ADD (QUOTE 1) X))) the LETREC statement crashes and burns (LETREC is like defun
in Common LISP).

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu