RE: LISP-like expressions
- Posted by Andy Serpa <ac at onehorseshy.com> Mar 04, 2004
- 751 views
Mike Nelson wrote: > > > > I've noticed that there is a striking similarity between Lisp and > > Euphoria: Lists and sequences are almost exactly the same thing. > > > > The only things that Euphoria lacks in order for it to actually by > > definition *be* Lisp is functions as first-class objects (meaning, > > essentially, that an actual function object can be returned as the > > *result* of another function) and the use of the same sequence notation > > as standard syntax for everything. > > > > I just find this really interesting, and wonder if perhaps coupled with > > Diamond or a similar object system, Euphoria could in fact have some of > > the extra benefits of Lisp. > > > > I'd need to study more Lisp to see if I could implement all of what you > are > discussing. I'm confident that I could provide function objects as part > of > the Diamond Standard Class Library or as part of the Diamond kernel. I > will > look into this possiblity after I complete the 4.0 release. > Well, you can pass around functions as first-order objects in Euphoria using routine-id. It is kind of clumsy and not nearly as elegant as in a real functional language like Haskell, but it can be done. I've implemented genetic programming in Euphoria (usually done in LISP) where arbitrary functions are strung together. You have to write a routine-id based evaluator to process the resulting expressions, but it works fine...