-
-
Notifications
You must be signed in to change notification settings - Fork 104
type for the optional arguments of 'in-fx/fl/extflvector' #953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
What would be a good test for this? Or how how to test this? I see in the unit-test/typecheck-tests.rkt file. Best to add an extra test over there? |
|
Since you are already adding a new test file, putting it there also makes sense. But really, I don't care where it's tested (though other people might, idk). |
| (check-equal? (for/list : (Listof Fixnum) ([i (in-fxvector (fxvector 1 2 3 4) 3 -1 -2)]) i) | ||
| (list 4.0 2.0)) | ||
|
|
||
| (check-equal? (for/list : (Listof extflonum) ([i (in-extflvector (extflvector 1.0t0 2.0t0 3.0t0 4.0t0) 3 -1 -2)]) i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test should be behind a (when (extflonum-available?) ...) check.
|
I see this fails for the cs branch, and looking into it, I don't understand why it succeeds on the bc branch. I don't know if typed-racket does something extra but if it is just using the racket implementation then I think the types for the indexes should be: I can change the test, to only count upwards in a for loop, |
|
@samth, I went ahead and changed the type for normalise-inputs to allow going backward through the vector. |
|
Fantastic! I'll take a look and hopefully we can merge soon. |
| (check-equal? (sequence->list (in-fxvector (fxvector 1 2 3 4) 0 #f 2)) (list 1 3)) | ||
| (check-equal? (for/list : (Listof Fixnum) ([i : Fixnum (ann (in-fxvector (fxvector 1 2 3 4) 3 -1 -2) (Sequenceof Fixnum))]) i) | ||
| (list 4 2)) | ||
| ;; I don't understand why this fails... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you say more about this failure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hoping to be able to do:
(for/list : (Listof Fixnum) ([i (in-fxvector (fxvector 1 2 3 4) 3 -1 -2)]) i)
but without the annotation of (Sequenceof Fixnum) and Fixnum for i (both are necessary) The resulting list is seen as (Listof Integer)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a quick look at this failure. Seems it has something to do with unsafe-normalise-inputs and normalise-inputs. I might get back to some point later next week
|
I'm going to merge this now; we can try to make that example work with less annotation in the future. |
add type for the optional arguments of 'in-fx/fl/extflvector' as in 'in-vector'