Update types of string-join and add-between.

This commit is contained in:
Vincent St-Amour 2012-06-27 11:37:50 -04:00
parent fb2b5418df
commit db6c2e7737
2 changed files with 12 additions and 3 deletions

View File

@ -339,7 +339,10 @@
-String]
[tc-e (string-join '("hello" "world") " ") -String]
[tc-e (string-join '("hello" "world")) -String]
[tc-e (string-join '("hello" "world") #:first "a") -String]
[tc-e (string-join '("hello" "world") #:before-first "a") -String]
[tc-e (add-between '(1 2 3) 0) (-lst -Byte)]
[tc-e (add-between '(1 2 3) 'a) (-lst (t:Un -PosByte (-val 'a)))]
[tc-e ((inst add-between Positive-Byte Symbol) '(1 2 3) 'a #:before-first 'b) (-lst (t:Un -PosByte -Symbol))]
[tc-e (apply (plambda: (a) [x : a *] x) '(5)) (-lst -PosByte)]
[tc-e (apply append (list '(1 2 3) '(4 5 6))) (-lst -PosByte)]

View File

@ -366,7 +366,7 @@
[string-join
(->optkey (-lst -String) [-String]
#:before-last -String #f #:first -String #f #:last -String #f
#:before-last -String #f #:before-first -String #f #:after-last -String #f
-String)]
@ -1393,7 +1393,13 @@
(-> (make-pred-ty a) (-lst b) (-values (list (-lst a) (-lst b))))))]
[last (-poly (a) ((-lst a) . -> . a))]
[add-between (-poly (a b) ((-lst a) b . -> . (-lst (Un a b))))]
[add-between (-poly (a b) ((-lst a) b
#:splice? -Boolean #f
#:nothing Univ #f ; default is gensym
#:before-first b #f
#:before-last b #f
#:after-last b #f
. ->key . (-lst (Un a b))))]
[last-pair (-poly (a) ((-mu x (Un a (-val '()) (-pair a x)))
. -> .