mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 15:01:41 +00:00
Scheme: Make apply follow the R5RS standard.
This commit is contained in:
parent
5480c38da5
commit
fd54b1a245
1 changed files with 12 additions and 1 deletions
|
@ -213,6 +213,7 @@ SchemeObject bi_cdr (SchemeObject args, Machine m)
|
|||
|
||||
SchemeObject bi_apply (SchemeObject args, Machine m)
|
||||
{
|
||||
local SchemeObject cur, prev;
|
||||
if (args == [Nil nil]) {
|
||||
return [Error type: "apply"
|
||||
message: "expected at least 1 argument"
|
||||
|
@ -224,8 +225,18 @@ SchemeObject bi_apply (SchemeObject args, Machine m)
|
|||
[[args car] printForm])
|
||||
by: m];
|
||||
}
|
||||
|
||||
prev = NIL;
|
||||
|
||||
[m stack: [[args cdr] car]];
|
||||
for (cur = args; [cur cdr] != [Nil nil]; cur = [cur cdr]) {
|
||||
prev = cur;
|
||||
}
|
||||
|
||||
if (prev) {
|
||||
[prev cdr: [cur car]];
|
||||
}
|
||||
|
||||
[m stack: [args cdr]];
|
||||
[[args car] invokeOnMachine: m];
|
||||
return NIL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue