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

Home » Public Forums » archive » Anonymous Math Functions in IDL like Matlab
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: Anonymous Math Functions in IDL like Matlab [message #75371 is a reply to message #75310] Thu, 03 March 2011 15:13 Go to previous messageGo to previous message
rtk is currently offline  rtk
Messages: 22
Registered: September 2008
Junior Member
I wrote a bunch of higher-order function stuff for IDL awhile back and
included a hack that simulated a lambda function. Basically, it
defined the function on the fly and returned a string with the actual
name. You then used this with the higher-order function (or any
function). So, for your example,

square = lambda('x:x^2')

but to use it directly:

ans = call_function(square, 4)

Outside the context of a higher-order function, this isn't really that
useful. Still, if you want the code, I'll send it, just email me
"oneelkruns" "hotmail" "com". The higher-order functions were DLMs
for Linux and Windows, 32-bit only.

Also, you can define a procedure/function in IDL from the command
line. No need to quit and type a new file:

IDL> .run
- function square, x
- return, x*x
- end
% Compiled module: SQUARE.
IDL> print, square(4)

Perhaps what you are really looking for?

Ron
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Plotimage and non-byte images
Next Topic: Re: Read ASCII File with tab seperator

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

Current Time: Wed Oct 08 19:20:22 PDT 2025

Total time taken to generate the page: 0.00390 seconds