~ chicken-core (chicken-5) 2a8feb5ed1b432fc89ef763a927cce55bf163098
commit 2a8feb5ed1b432fc89ef763a927cce55bf163098
Author: Evan Hanson <evhan@foldling.org>
AuthorDate: Sat Feb 13 23:51:07 2016 +1300
Commit: Peter Bex <peter@more-magic.net>
CommitDate: Sat Feb 13 19:11:55 2016 +0100
Preserve type of first element in memq/memv procedure results
If the result is a list, its first element will be the same type as the
first procedure argument.
Signed-off-by: Peter Bex <peter@more-magic.net>
diff --git a/types.db b/types.db
index 114aac15..aa386489 100644
--- a/types.db
+++ b/types.db
@@ -174,13 +174,13 @@
(reverse (forall (a) (#(procedure #:clean #:enforce) reverse ((list-of a)) (list-of a)))
((null) (null) (let ((#(tmp) #(1))) '())))
-(memq (forall (a) (#(procedure #:clean) memq (* (list-of a))
- (or false (list-of a))))
+(memq (forall (a b) (#(procedure #:clean) memq (a (list-of b))
+ (or false (pair a (list-of b)))))
((* null) (let ((#(tmp) #(1))) '#f))
((* list) (##core#inline "C_u_i_memq" #(1) #(2))))
-(memv (forall (a) (#(procedure #:clean) memv (* (list-of a))
- (or false (list-of a))))
+(memv (forall (a b) (#(procedure #:clean) memv (a (list-of b))
+ (or false (pair a (list-of b)))))
((* null) (let ((#(tmp) #(1))) '#f))
(((or symbol procedure immediate) list)
(##core#inline "C_u_i_memq" #(1) #(2))))
Trap