[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: passing functions as arguments in IDL?
- Subject: Re: passing functions as arguments in IDL?
- From: Benno Puetz <puetz(at)mpipsykl.mpg.de>
- Date: Tue, 29 Feb 2000 15:20:06 +0100
- Newsgroups: comp.lang.idl-pvwave
- Organization: Max-Planck-Inst. f. Psychiatrie, NMR
- References: <38971B2F.8577EBB6@hpl.hp.com> <MPG.1300d5762a6bdf7989a07@news.frii.com>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:18714
David Fanning wrote:
> Rick Baer (baer@hpl.hp.com) writes:
>
> > Is there any way to pass functions as arguments in IDL? I would
> > like to be able to do something like this:
> >...
> > IDL> print, tf1, f1, 4
>
> You can do this:
>
> function f1, x
> return, x*x
> end
>
> function tf1, func, arg
> IF Size(func, /Type) NE 7 THEN BEGIN
> Print, 'String argument required'
> RETURN, -1
> ENDIF
> retVal = Call_Function(func, arg)
> return, retVal
> end
>
> IDL> print, tf1('f1', 4)
>
> Cheers,
>
> David
> --
Would it also be possible to pass argument lists of variable length,
depending on the function to be called?
I've tried the _EXTRA keyword but to no avail ...
--
Benno Puetz
Kernspintomographie
Max-Planck-Institut f. Psychiatrie Tel.: +49-89-30622-413
Kraepelinstr. 10 Fax : +49-89-30622-520
80804 Muenchen, Germany