[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Are functional objects (functors/closures) possible?
From: |
Brett Viren |
Subject: |
Re: Are functional objects (functors/closures) possible? |
Date: |
Fri, 22 Nov 2002 13:16:06 -0500 |
Paul Kienzle writes:
> Hmmm....
>
> maybe you could fake a curry using a DLD function. You could
> call it something like:
>
> f = curry('x','y','g(x,y,$a,$b)')
>
> which would do the equivalent of the following:
>
> static n = 0;
> global curry_val;
> s.a = a;
> s.b = b;
> curry_val{n} = s;
> eval(sprintf("function curry_ret = curry%d(x,y)\n\
> s=curry_val{%d};\n\
> curry_ret=g(x,y,s.a,s.b);\n\
> endfunction",n,n);
> n++;
Yes, I think I get it. Clever.
Also, I didn't learn yet that octave had an "eval" function. I think
this negates what I said to John about being limited by not being able
to generate new functions dynamically.
I must say, octave is pretty cool.
Thanks,
-Brett.
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------