If N is greater or equal to the length of LIST, return LIST (or a copy). */)
(Lisp_Object n, Lisp_Object list)
{
- CHECK_FIXNUM (n);
+ if (BIGNUMP (n))
+ {
+ if (mpz_sgn (*xbignum_val (n)) < 0)
+ return Qnil;
+ CHECK_LIST (list);
+ return list;
+ }
+ if (!FIXNUMP (n))
+ wrong_type_argument (Qintegerp, n);
EMACS_INT m = XFIXNUM (n);
if (m <= 0)
return Qnil;
Otherwise, return LIST after truncating it. */)
(Lisp_Object n, Lisp_Object list)
{
- CHECK_FIXNUM (n);
+ if (BIGNUMP (n))
+ {
+ if (mpz_sgn (*xbignum_val (n)) < 0)
+ return Qnil;
+ CHECK_LIST (list);
+ return list;
+ }
+ if (!FIXNUMP (n))
+ wrong_type_argument (Qintegerp, n);
EMACS_INT m = XFIXNUM (n);
if (m <= 0)
return Qnil;
(should (equal (take 5 list) '(a b c b c)))
(should (equal (take 10 list) '(a b c b c b c b c b)))
- (should (equal (ntake 10 list) '(a b)))))
+ (should (equal (ntake 10 list) '(a b))))
+
+ ;; Bignum N argument.
+ (let ((list (list 'a 'b 'c)))
+ (should (equal (take (+ most-positive-fixnum 1) list) '(a b c)))
+ (should (equal (take (- most-negative-fixnum 1) list) nil))
+ (should (equal (ntake (+ most-positive-fixnum 1) list) '(a b c)))
+ (should (equal (ntake (- most-negative-fixnum 1) list) nil))
+ (should (equal list '(a b c)))))
;;; fns-tests.el ends here