-
Notifications
You must be signed in to change notification settings - Fork 78
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
Improve RandomAccessList API with some functions from PersistentVector #54
Conversation
These are the easy functions, which aren't dependent on order of insertion. Functions like append and windowSeq will be harder, so wait until later to add those. But take the low-hanging fruit now.
do we need tests for this? |
Honestly, having looked at how extensive the test suite is, I'd feel better if anything I added also had tests, so I plan to write unit tests anyway whether or not this commit is merged before the tests are ready. But given the simplicity of these functions and how hard they would be to get wrong, I figured might as well create the PR now. (I plan to try to write an implementation of |
I think most tests can be copied over from vector. But we should do this. |
I have tests written now, and I'm about ready to update this PR with my changes. But there's one question of design I want to talk about before I update it: the design of the PersistentVectors conj on the end of the vector, so it's natural for their But if we have a RandomAccessList equivalent to Smaller list first: Smaller list last: The code I've written so far follows smaller list first semantics for So, for you, which of those two options would be the most surprising? Given that RandomAccessList uses |
Note: windowSeq semantics are to put the short list, if there is one, first (the mirror of how PersistentVector.windowSeq works).
... Huh. I have F# 4 on my computer, and it builds fine there, with all unit tests passing. But since the Travis buildbot has F# 3.1, it won't build -- because I used I assume we still need to maintain 3.1 compatibility, right? I'll refactor |
I think depending on FSharp.Core 4 is fine. Will take a look |
These are the easy functions, which aren't dependent on order of insertion. Functions like append and windowSeq will be harder, so wait until later to add those. But take the low-hanging fruit now.
Note that I have not yet written unit tests for these. These functions are straightforward, and I copied the implementations from PersistentVector and just changed the type signatures (and parameter names), so I doubt that there are any errors. So feel free to merge this now if you want; but if you want to hold off on merging this PR until I can write unit tests for these new functions, I can do that within the next couple of days.