mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-05 11:40:20 +02:00
Implement apply correctly
This commit is contained in:
parent
b939d51f8a
commit
6f77715457
1 changed files with 10 additions and 2 deletions
|
@ -288,8 +288,16 @@ scheme.is_true = function (obj) {
|
|||
};
|
||||
|
||||
// Builtins
|
||||
var apply = function(self, k, f, arg) {
|
||||
return f.fun(f.freevars, k, arg);
|
||||
var apply = function(self, k, f) {
|
||||
var args = Array.prototype.slice.call(arguments, 3);
|
||||
var tail = args.pop();
|
||||
|
||||
while (scheme.is_true(scheme.primitives["pair?"](tail))) {
|
||||
args.push(tail.car);
|
||||
tail = tail.cdr;
|
||||
};
|
||||
|
||||
return f.fun.apply(f.fun, [f,k].concat(args));
|
||||
};
|
||||
|
||||
var values = function(self, k) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue