The PtII expression language doesn't have 'currying': >> adder = function(x,y) x+y (function(x, y) (x+y)) >> adder(1) Wrong number of arguments when applying function (function(x, y) (x+y))
But you can simulate it with functions that return functions: >> adder = function(x) function(y) x+y (function(x) (function(y) (x+y))) >> adder(1) (function(y) (1+y)) >> adder(1)(2) 3 Some methods supported by FunctionTokens: >> adder = function(x,y) x+y (function(x, y) (x+y)) >> adder.getNumberOfArguments 2 >> adder.apply({10,2}) 12 >> adder.getType object((function(a0:general, a1:general) general)) We can define our own 'apply' function: >> apply = function(f:(function() general),args:{general}) f.apply(args) (function(f:(function() general), args:{general}) f.apply(args)) >> adder (function(x, y) (x+y)) >> apply(adder,{1,2}) 3 Tobin ---------------------------------------------------------------------------- Posted to the ptolemy-hackers mailing list. Please send administrative mail for this list to: [EMAIL PROTECTED]