[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*Subject*: Re: defining functions on-the-fly*From*: Marc Schellens <m_schellens(at)hotmail.com>*Date*: Wed, 23 May 2001 13:42:05 +0900*Newsgroups*: comp.lang.idl-pvwave*Organization*: RIKEN*References*: <9eep9u$oq8$1@agate.berkeley.edu>*Xref*: news.doit.wisc.edu comp.lang.idl-pvwave:25054

Marshall Perrin wrote: > > I would like to be able to define some functions on-the-fly in IDL. > In other words, my program does some stuff, and computes that the desired > function is (some arbitrary function, not necessarily a polynomial). > I would then like to define the equivalent of > FUNCTION myfunction, x,y > return, <my arbitrary expression in (x,y)> > END > and then be able to call myfunction(x,y). > > Is there any easier way to do this than actually writing out a > myfunction.pro file to disk and compiling that? That way would certainly > work, but it strikes me as inelegant... At first I thought I could do this > with the EXECUTE statement, but you can't define functions using that. > > - Marshall try .comp: IDL> .comp [ENTER] - function f - return,42 - end % Compiled module: F. IDL> print,f() 42 IDL> cheers, :-) marc

**Follow-Ups**:**Re: defining functions on-the-fly***From:*Marshall Perrin

**Re: defining functions on-the-fly***From:*Craig Markwardt

**References**:**defining functions on-the-fly***From:*Marshall Perrin

- Prev by Date:
**Re: Locate an underflow** - Next by Date:
**Re: bitwise operators in IDL?** - Prev by thread:
**defining functions on-the-fly** - Next by thread:
**Re: defining functions on-the-fly** - Index(es):