Require extraHandling for variadic zip

This commit is contained in:
2021-07-12 16:44:37 -06:00
parent 0af3749975
commit 34688ece62
2 changed files with 3 additions and 3 deletions

View File

@@ -171,7 +171,7 @@ class Macros {
}; };
macros["zip"] = (wholeExp:ReaderExp, exps:kiss.List<ReaderExp>, k) -> { macros["zip"] = (wholeExp:ReaderExp, exps:kiss.List<ReaderExp>, k) -> {
wholeExp.checkNumArgs(2, null, '(zip [listA] [listB] [moreLists...])'); wholeExp.checkNumArgs(3, null, '(zip [listA] [listB] [moreLists...] [extraHandling])');
var b = wholeExp.expBuilder(); var b = wholeExp.expBuilder();
return b.callSymbol("Prelude.zip", [b.list(exps.slice(0, -1)), exps[-1]]); return b.callSymbol("Prelude.zip", [b.list(exps.slice(0, -1)), exps[-1]]);
}; };

View File

@@ -35,9 +35,9 @@
// TODO rectangle type // TODO rectangle type
// TODO optional source rectangle argument // TODO optional source rectangle argument
(defmethod blitSurface [:Surface surface x y] (defmethod blitSurface [:Surface surface x y]
(doFor [srcX destX] (zip (collect (range 0 surface.width)) (collect (range x (+ x surface.width)))) (doFor [srcX destX] (zip (collect (range 0 surface.width)) (collect (range x (+ x surface.width))) Drop)
(when (< -1 destX width) (when (< -1 destX width)
(doFor [srcY destY] (zip (collect (range 0 surface.height)) (collect (range y (+ y surface.height)))) (doFor [srcY destY] (zip (collect (range 0 surface.height)) (collect (range y (+ y surface.height))) Drop)
(when (< -1 destY height) (when (< -1 destY height)
(when (surface.isCellOpaque srcX srcY) (when (surface.isCellOpaque srcX srcY)
(setBackgroundColor destX destY (surface.getBackgroundColor srcX srcY)) (setBackgroundColor destX destY (surface.getBackgroundColor srcX srcY))