Re: Another Error
- Posted by CChris <christian.cuvier at agriculture.gouv.fr> Feb 01, 2007
- 674 views
Pete Lomax wrote: > > CChris wrote: > > One thing which I find missing in Eu is the ability to perform element wise > > operations that might apply to sequences as a whole. I'd like to > > be able to write > > > > }}} <eucode> > > s=atom(`x) > > </eucode> {{{ > > > I have a psqop.e file which wraps some 35 such functions like you showed, if > that helps. The above is available as sq_atom(x). > > >In a nutshell, functional operators are missing. > Are you talking about routine_id not working on builtins? Again, you could > write > a standard include to solve this, eg: > > }}} <eucode> > function _atom(object o) > return atom(o) > end function > > function Routine_ID(sequence name) > integer r > r = routine_id(name) > if r=-1 then > r=routine_id('_'&name) > end if > return r > end function > </eucode> {{{ > > Regards, > Pete Actually, I have done this myself, see the routines.e and seqop.e files from oedoc.free.fr/Fichiers/ESL . atom(`x) would translate to apply_func(routine_id("atom"),x) (needs both include files). However, it seems obvious that using them incurs some performance penalty that would mostly go away if implemented in the backend. routines.e gives you various examples of what I call functional operators. routine ids for builtins are only a related topic there. Regards CChris