added args checking to prefix functions

This commit is contained in:
Spencer Florence 2015-09-04 16:03:54 -05:00 committed by Vincent St-Amour
parent 079f46fbc1
commit 3018417249
2 changed files with 5 additions and 0 deletions

View File

@ -615,6 +615,7 @@
(test '((a b c d) () ()) split*-list '(a b c d) '(a b c d))
(test '((1 2) (3 4) (4 3)) split*-list '(1 2 3 4) '(1 2 4 3) =)
(err/rt-test (split*-list '() '() #f))
(err/rt-test (take-common-prefix 1 1))
;; ---------- remf / remf* ----------

View File

@ -287,6 +287,10 @@
;; lists, and return a matching number of values.
(define (internal-split-common-prefix as bs same? keep-prefix? name)
(unless (list? as)
(raise-argument-error name "list?" as))
(unless (list? bs)
(raise-argument-error name "list?" bs))
(unless (and (procedure? same?)
(procedure-arity-includes? same? 2))
(raise-argument-error name "(any/c any/c . -> . any/c)" same?))