-
-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9313f9c
add type for the optional arguments of 'in-fx/fl/extflvector' as in '…
bdeket 62b8290
tests for in-xvector
bdeket 37870d3
typo mandatory arguments
bdeket e67f2d0
add test for the 'for/*' case
bdeket 97b97e5
Add test for extflonum
bdeket d2f310a
update type for normalise-inputs
bdeket afad4df
update test and 'unsafe-normalise-inputs
bdeket File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #lang typed/racket/base | ||
|
|
||
| (require racket/sequence | ||
| racket/flonum | ||
| racket/fixnum | ||
| racket/extflonum | ||
| typed/rackunit) | ||
|
|
||
| (check-equal? (sequence->list (in-flvector (flvector 1.0 2.0 3.0 4.0))) (list 1.0 2.0 3.0 4.0)) | ||
| (check-equal? (sequence->list (in-flvector (flvector 1.0 2.0 3.0 4.0) 1)) (list 2.0 3.0 4.0)) | ||
| (check-equal? (sequence->list (in-flvector (flvector 1.0 2.0 3.0 4.0) 1 2)) (list 2.0)) | ||
| (check-equal? (sequence->list (in-flvector (flvector 1.0 2.0 3.0 4.0) 0 #f 2)) (list 1.0 3.0)) | ||
| (check-equal? (for/list : (Listof Flonum) ([i (in-flvector (flvector 1.0 2.0 3.0 4.0) 3 -1 -2)]) i) | ||
| (list 4.0 2.0)) | ||
|
|
||
| (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... | ||
| #;(check-equal? (for/list : (Listof Fixnum) ([i (in-fxvector (fxvector 1 2 3 4) 3 -1 -2)]) i) | ||
| (list 4 2)) | ||
|
|
||
| (when (extflonum-available?) | ||
| (check-equal? (for/list : (Listof ExtFlonum) ([i (in-extflvector (extflvector 1.0t0 2.0t0 3.0t0 4.0t0) 3 -1 -2)]) i) | ||
| (list 4.0t0 2.0t0))) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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)andFixnumfori(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