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

Home » Public Forums » archive » lambda function syntax
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: lambda function syntax [message #92275 is a reply to message #92249] Mon, 09 November 2015 09:30 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Thursday, November 5, 2015 at 7:36:12 AM UTC-7, greg...@googlemail.com wrote:
> I've created a lambda procedure inside an object (to hold a user-defined function):
>
> self.lambda=lambdap("t,n1:"+code)
>
> where, e.g. code="n1=sqrt(t)"
>
> This appears to work fine, but I can't figure out a legal syntax to call it inside a method:
>
>
> function test_obj::N1,t
> self.n1_lambda,t,n1
> return,n1
> end
>
>
> IDL> print,obj->n1(1)
> % Attempt to call undefined method: 'TEST_OBJ::N1_LAMBDA'.
>
> ---
>
> Having written the example, I discovered it does work if I do this:
>
> function test_obj::N1,t
> lam=self.n1_lambda
> lam,t,n1
> return,n1
> end
>
> which isn't so bad. The first should be correct syntax, though, I think.
>
> cheers,
> Greg

Hi Greg,

Yeah, I don't think this is going to work. The parser is interpreting that at compile time as a method call, rather than waiting until runtime. I thought that setting "compile_opt strictarr" might help, but it didn't.

I think your workaround is the best solution. Sorry about that.

-Chris
[Message index]
 
Read Message
Read Message
Previous Topic: errors in robust_linefit
Next Topic: EXIT from within an application

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

Current Time: Wed Oct 08 13:56:04 PDT 2025

Total time taken to generate the page: 0.00380 seconds