File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -906,11 +906,23 @@ void is_source_value(Context& C, ValueRefs Args) {
906906}
907907
908908void apply (Context& C, ValueRefs Args) {
909- if (Args.size () < 1 )
909+ llvm::SmallVector<heavy::Value, 8 > NewArgs;
910+
911+ if (Args.size () == 1 )
912+ return C.Apply (Args[0 ], NewArgs);
913+ if (Args.size () < 2 )
910914 return C.RaiseError (" invalid arity" );
911- Value Fn = Args[0 ];
912- Args = Args.drop_front ();
913- C.Apply (Fn, Args);
915+
916+ Value Fn = Args.front ();
917+ Value LastArg = Args.back ();
918+ Args = Args.drop_front ().drop_back ();
919+
920+ for (heavy::Value Arg : Args)
921+ NewArgs.push_back (Arg);
922+ for (heavy::Value Arg : LastArg)
923+ NewArgs.push_back (Arg);
924+
925+ C.Apply (Fn, NewArgs);
914926}
915927
916928void make_syntactic_closure (Context& C, ValueRefs Args) {
Original file line number Diff line number Diff line change 1515(apply check-list 1 2 3 )
1616; CHECK: (1 2 3 4 5)
1717(apply check-list 1 2 3 4 5 )
18+ ; CHECK: (1 2 3 4 5)
19+ (apply check-list 1 2 3 ' (4 5 ))
20+ ; CHECK: (1 2 3 4 5)
21+ (apply check-list 1 2 3 ' (4 . 5 ))
You can’t perform that action at this time.
0 commit comments