comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: defining functions on-the-fly
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: defining functions on-the-fly [message #25126] Tue, 22 May 2001 21:42 Go to previous message
marc schellens[1] is currently offline  marc schellens[1]
Messages: 183
Registered: January 2000
Senior Member
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
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: warping continents to magnetic coordinates
Next Topic: defining functions on-the-fly

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:54:01 PDT 2025

Total time taken to generate the page: 0.00349 seconds