|
|
"Bald Eagle" <cre### [at] netscapenet> wrote:
> So, I had some experiments I wanted to try, but I need to make some functions
> that are based on other functions.
> In order to vary what base function I use, I have to do that with a macro, which
> seems to work fine, but I seem to be missing something, either in the creation
> syntax or the invocation syntax.
>
>
> #declare Zero = function (N) {0}
> #declare One = function (N) {1}
>
>
> #macro MakeFunction (Function)
> function {Function (0) + 1}
> #end
>
> #declare Two = MakeFunction (One);
>
> #debug concat( "Zero = ", str (Zero (10), 0, 3), "\n")
> #debug concat( "One = ", str (One (10), 0, 3), "\n")
>
> #declare Val = Two (10);
>
> #debug concat( "Two = ", str (Val, 0, 3), "\n")
>
> That gets me:
>
> Parse Error: Expected 'numeric expression', ) found instead
>
> I have yet to find a way around that. Though I could swear that I've done
> something similar to this before....
>
>
> Does anyone have any ideas?
Try this:
#macro MakeFunction(Fn)
function(N) { Fn(0) + 1 }
#end // macro MakeFunction
--
Tor Olav
http://subcube.com
https://github.com/t-o-k
Post a reply to this message
|
|