Skip to content
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

Array functions #107

Open
10 of 25 tasks
tomek-he-him opened this issue Jun 11, 2015 · 5 comments
Open
10 of 25 tasks

Array functions #107

tomek-he-him opened this issue Jun 11, 2015 · 5 comments
Milestone

Comments

@tomek-he-him
Copy link
Member

@tomek-he-him
Copy link
Member Author

Refs #125 (comment)

concat, push and shift have some strange behaviours. Let’s make them more predictable:

push(3, [1, 2])      ===  // This is ready – thanks @stoeffel
shift(1, [2, 3])     ===
concat([3], [1, 2])  ===
[1, 2, 3];

concat(3, [1, 2]);  // TypeError!

@tomek-he-him
Copy link
Member Author

Does pop and unshift make any sense?

head([1, 2, 3]);  //» 1
unshift([1, 2, 3]);   //» [2, 3]

@davidchase
Copy link
Member

@tomekwi question... is there a need to do shift which seems to be a syntactic sugar for
drop(1, [1,2,3]) which seems to have a different notation here than some thing like
drop = (n, xs) => xs.slice(n, Infinity) you would get the same thing you get with native shift plus immutability thoughts?

@tomek-he-him
Copy link
Member Author

Oh yeah, I seem to have mixed up shift with unshift. I meant unshift up in #107 (comment) and shift in the next message. I use the native ones very rarely anyway.

Your idea for drop seems very reasonable to me. Perhaps another name like omit would make sense?

And yeah, this whole library is really just synctatic sugar. Sugar is great when you use stuff often. So if it turns out that omit(1, …) is a useful thing, we can upgrade that to a separate function.

@davidchase
Copy link
Member

Gotcha yeah sorry coming from ramda land so drop and omit have a different implementation and usage. But omit as you mention above would useful imho.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants