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

Home » Public Forums » archive » Re: "foreach" loops in IDL
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: "foreach" loops in IDL [message #64805 is a reply to message #64803] Fri, 16 January 2009 10:54 Go to previous messageGo to previous message
rtk is currently offline  rtk
Messages: 22
Registered: September 2008
Junior Member
On Jan 16, 11:30 am, alaniwiuse...@googlemail.com wrote:
> In case anyone's interested, I've produced a little hack that lets you
> have "foreach" loops in IDL

Neat hack!

Along the same lines, I have a set of DLMs here that add things like
foreach, map, filter, reduce, etc. to IDL along with lambda functions
and lists:

http://www.ittvis.com/info/hof/

For example, with the foreach DLM, your example becomes:

foreach, lambda('x: print, x', /P), myarray

There is also a pure IDL version for functions called 'each()' which
is quite useful.

Map, filter and reduce work pretty much as they do in Python (with
extensions). There are also compose, apply, cart, accumulate, and
group higher-order functions. With cart() it is possible to do the
equivalent of Python list comprehensions.

If you try it and have any questions let me know.

Ron
oneelkruns@hotmail.com
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: ERRPLOT using object Graphics .... ?
Next Topic: Contour command

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

Current Time: Fri Oct 10 14:51:20 PDT 2025

Total time taken to generate the page: 0.32048 seconds