summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib.c4
-rw-r--r--tests/012/seq.tl3
2 files changed, 7 insertions, 0 deletions
diff --git a/lib.c b/lib.c
index 0fdc8ef0..7f797bb1 100644
--- a/lib.c
+++ b/lib.c
@@ -3575,8 +3575,12 @@ static val tuples_func(val n, val lcons)
val tuples(val n, val seq, val fill)
{
+ val self = lit("tuples");
seq = nullify(seq);
+ if (!plusp(n) || !integerp(n))
+ uw_throwf(error_s, lit("~a: positive integer required, not ~s"), self, n, nao);
+
if (!seq)
return nil;
diff --git a/tests/012/seq.tl b/tests/012/seq.tl
index d434ad52..d27adcef 100644
--- a/tests/012/seq.tl
+++ b/tests/012/seq.tl
@@ -212,3 +212,6 @@
[separate chr-isalpha "a1b2c3d4"] ("abcd" "1234")
[separate chrp "a1b2c3d4"] ("a1b2c3d4" "")
[separate integerp "a1b2c3d4"] ("" "a1b2c3d4"))
+
+(mtest
+ (tuples 0 '(1 2 3)) :error)