-
Notifications
You must be signed in to change notification settings - Fork 51
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
Implement the Array API #27
Conversation
You might also notice the show $ fromFoldable [1, 2, 3] == "<1,2,3>" This is a placeholder until a proper representation is chosen. |
This looks really great.
That definitely looks like a better approach than what I was doing before.
If List implemented Do you think having this as a |
I think show $ fromFoldable [1, 2, 3] == "fromFoldable [1, 2, 3]" would be an appropriate representation. In JavaScript I'm thinking that list(1, 2, 3).toString() === "list(1, 2, 3)" |
No it wouldn't. You're welcome to improve the efficiency of the current implementation of course 😄 |
Idk. That's probably a better question for the #purescript Slack |
7807de5
to
9c81940
Compare
purescript/src/Funkia/List.js
Outdated
|
||
exports.length = function length(l) { | ||
return l.length; | ||
}; |
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.
List exports a length
so this could be exports.length = L.length
.
purescript/src/Funkia/List/Types.js
Outdated
if (!f(L.nth(i, xs))(L.nth(i, ys))) return false; | ||
} | ||
return true; | ||
}; |
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.
What about adding an equalsBy
to List itself?
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.
Do you see general utility for equalsBy
?
@paldepind I've make some changes/additions. |
@paldepind I didn't want to presume anything about the documentation style or how you might want to include examples and algorithmic complexity. If you want to merge this as-is and tackle the docs yourself that would be great. Otherwise, I'd like some guidance concerning style/examples when you have time. |
What do you think about the name If you think that name is fine then I suggest the following: I create a new GitHub repository in Funkia with that name, you create an identical PR for that repo, I merge it and publish it to Pursuit. Then PS users can actually start trying the library and additional improvements can be based off of that 😄 Btw, I highly appreciate the work you've done in this PR! |
Honestly I don't like Maybe |
That said, I don't want to hold things up. I know there's a market for a data structure like this. |
|
I prefer I've created a repo for the PS bindings here: https://github.com/funkia/purescript-rrb-list |
How would you like the package namespaced? |
Would the |
There's a trend moving away from the The prefix seems unnecessary and arbitrary to me. I think |
Oh, well, that is a trend I can get behind 😄
I agree 😄 |
Superceeded by funkia/purescript-rrb-list#1. |
I've started by copying the code from https://github.com/purescript/purescript-arrays/blob/master/src/Data/Array.purs and modifying it to use this list implementation.
I've chosen to simplify the FFI JS files by using
Fn<n>
,runFn<n>
andmkFn<n>
instead of manually currying. There is less potential for errors using this strategy and the possibility of future compiler optimizations.updateAtIndices
,modifyAtIndices
,sort
,sortBy
,sortWith
,group
,group'
, and,groupBy
have yet to be implemented (I also didn't write anOrd
instance).I implemented
Traversable
as a placeholder until it's available "natively".There's certainly room for improvement in organization and documentation.
Note: The doc comments are barely changed from those in
-arrays
and I'm unsure what the licensing implications are.