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

Sliced Iterator similar to Scala Iterator.slice method #1188

Closed
fanifieiev opened this issue Sep 18, 2019 · 47 comments
Closed

Sliced Iterator similar to Scala Iterator.slice method #1188

fanifieiev opened this issue Sep 18, 2019 · 47 comments
Assignees

Comments

@fanifieiev
Copy link
Contributor

I could not find any implementation of sliced iterator, so I think it would be nice to have it in place.
Constructor:
public Sliced(final int fromIndex, final Iterator<T> iterator, final int limit)
An example is:
Iterator<Integer> sliced = new Sliced<>(2, new IteratorOf<>(1,2,3,4,5,6), 2);
that would return a slice of 2 elements starting from index 2, which will result in [3, 4].

PS: I have already implemented one and would like to create PR after this issue is created.

@0crat
Copy link
Collaborator

0crat commented Sep 18, 2019

@paulodamaso/z please, pay attention to this issue

@0crat
Copy link
Collaborator

0crat commented Sep 18, 2019

@fanifieiev/z this project will fix the problem faster if you donate a few dollars to it; just click here and pay via Stripe, it's very fast, convenient and appreciated; thanks a lot!

@paulodamaso
Copy link
Contributor

@fanifieiev I'd like it, BUT:
We have some other similar behavior in cactoos project and I think that we can reuse the code between them:
HeadOf: gets the first N elements of the collection
TailOf: gets the last N elements of the collection
Skipped: skip N elements of the collection
Partitioned: slices the collection in parts of equal size N

If we look carefully we could compose these decorators using the new proposed Sliced one:

  • HeadOf is an slice from 0 to N
  • TailOf is an slice from size-N to size
  • Skipped is an slice from N to size
  • Partitioned is a collection of slices of size/N, starting at 0 to N, N+1 to 2N, and so on

So let's do it: create the Sliced decorator and use it in the aforementioned implementation.

P.S.: Let's create it for all interfaces: Collection, Iterable, Iterator, etc

@paulodamaso
Copy link
Contributor

@0crat in

@paulodamaso
Copy link
Contributor

@0crat assign @fanifieiev

@0crat 0crat added the scope label Sep 18, 2019
@0crat
Copy link
Collaborator

0crat commented Sep 18, 2019

@0crat in (here)

@paulodamaso Job #1188 is already in scope

@0crat
Copy link
Collaborator

0crat commented Sep 18, 2019

@0crat assign @fanifieiev (here)

@paulodamaso The job #1188 assigned to @fanifieiev/z, here is why; the budget is 30 minutes, see §4; please, read §8 and §9; if the task is not clear, read this and this; @fanifieiev/z is not a member of this project yet, but they can request to join, as §1 explains; there will be no monetary reward for this job

@0crat
Copy link
Collaborator

0crat commented Sep 18, 2019

@0crat assign @fanifieiev (here)

@paulodamaso Thanks for your contribution, @fanifieiev/z! If you would be a member of the project, you would now earn +15 reputation points, as explained in §29. You can join and apply to it, see §2.

@0crat
Copy link
Collaborator

0crat commented Sep 18, 2019

Manual assignment of issues is discouraged, see §19: -5 point(s) just awarded to @paulodamaso/z

@0crat
Copy link
Collaborator

0crat commented Sep 18, 2019

It is strongly discouraged to assign jobs to their creators, see §19: -15 point(s) just awarded to @paulodamaso/z

@fabriciofx
Copy link
Contributor

@fanifieiev @paulodamaso II'm sorry, bu I didn't like this API. WDYT something like:

public Sliced(final int start, final int count, final T items...) {}
public Sliced(final int start, final int count, final Iterable<T> iterable) {}

@fanifieiev
Copy link
Contributor Author

@fanifieiev @paulodamaso II'm sorry, bu I didn't like this API. WDYT something like:

public Sliced(final int start, final int count, final T items...) {}
public Sliced(final int start, final int count, final Iterable<T> iterable) {}

@fabriciofx Is your concern related to the constructor parameter names?

@fanifieiev
Copy link
Contributor Author

fanifieiev commented Sep 19, 2019

@0crat review #1189

@paulodamaso
Copy link
Contributor

@fabriciofx What's the problem about that?

@fanifieiev
Copy link
Contributor Author

@fabriciofx What's the problem about that?

@paulodamaso I have already refactored the api, the changes are in there, in PR

@fabriciofx
Copy link
Contributor

@paulodamaso It didn't follow the Cactoos API pattern and IMHO it's more clear now. Ah, in time: I'm not the REV of this PR...

@0crat
Copy link
Collaborator

0crat commented Sep 19, 2019

@0crat review #1189 (here)

@fanifieiev Can't understand "review", try one of these:

  • assign Assign a performer to this issue
  • boost Set a boost for the job
  • continue Remove a job's impediment
  • hello Just say hello
  • in Register this issue in scope (WBS)
  • out Close the order and remove this job from scope
  • pay Pay a user some extra cash
  • quality Review a task
  • resign Resign from this issue
  • status Check the status of the job
  • version Print current version of the bot
  • wait Register an impediment for a job

@fabriciofx
Copy link
Contributor

@0crat status

@0crat
Copy link
Collaborator

0crat commented Sep 19, 2019

@0crat status (here)

@fabriciofx This is what I know about this job in C63314D6Z, as in §32:

@fanifieiev
Copy link
Contributor Author

@0crat status

@0crat
Copy link
Collaborator

0crat commented Sep 19, 2019

@0crat status (here)

@fanifieiev This is what I know about this job in C63314D6Z, as in §32:

@fanifieiev
Copy link
Contributor Author

@paulodamaso
Why am I banned?
The Contribution section of the page Cactoos says:

How to contribute?
Just fork the repo and send us a pull request.
Make sure your branch builds without any warnings/issues:

@paulodamaso
Copy link
Contributor

@fanifieiev You're banned from DEV role in the issue because you have opened it. Zerocrat does not assign issues to its creators. Your changes are being evaluated by @victornoel in #1189

@fanifieiev
Copy link
Contributor Author

@fanifieiev You're banned from DEV role in the issue because you have opened it. Zerocrat does not assign issues to its creators. Your changes are being evaluated by @victornoel in #1189
@paulodamaso
Ok, got it, I created the issue, but the assignment was done on behalf of you, right?
So, what is the proper way to join DEV ?
Thanks

@paulodamaso
Copy link
Contributor

paulodamaso commented Sep 20, 2019

@fanifieiev You need to join zerocracy in order to get reputation points and to be paid for jobs that have monetary rewards, please read the policy and join the platform in the link there.

Either way, your PR is being reviewed and will be merged as soon as @victornoel finishes the review

@0pdd
Copy link
Collaborator

0pdd commented Sep 25, 2019

@fanifieiev 4 puzzles #1191, #1192, #1193, #1194 are still not solved.

@0pdd
Copy link
Collaborator

0pdd commented Oct 10, 2019

@fanifieiev 3 puzzles #1191, #1193, #1194 are still not solved; solved: #1192.

@victornoel
Copy link
Collaborator

@fanifieiev this should be closed now, the tickets created by 0pdd will take over now for the rest of the work.

@fanifieiev
Copy link
Contributor Author

fanifieiev commented Oct 11, 2019

@fanifieiev this should be closed now, the tickets created by 0pdd will take over now for the rest of the work.

@victornoel Should I close it manually?

@victornoel
Copy link
Collaborator

@fanifieiev yes, that's what I meant :)

@fanifieiev
Copy link
Contributor Author

@0crat status

@0crat
Copy link
Collaborator

0crat commented Oct 11, 2019

@0crat status (here)

@fanifieiev This is what I know about this job in C63314D6Z, as in §32:

@fanifieiev
Copy link
Contributor Author

Work is done!!!

@0crat
Copy link
Collaborator

0crat commented Oct 11, 2019

Job #1188 is not in the agenda of @fanifieiev/z, can't retrieve data and time of add

@0crat
Copy link
Collaborator

0crat commented Oct 11, 2019

Job #1188 is not in the agenda of @fanifieiev/z, can't inspect

@0crat 0crat removed the scope label Oct 11, 2019
@0crat
Copy link
Collaborator

0crat commented Oct 11, 2019

@sereshqua/z please review this job completed by @fanifieiev/z, as in §30; the job will be fully closed and all payments will be made when the quality review is completed

@0crat
Copy link
Collaborator

0crat commented Oct 11, 2019

The job #1188 is now out of scope

@sereshqua
Copy link

@fanifieiev

  1. we need to make sure that problem reporter and problem solver are two different persons;
  2. you start all the comments from the name of the person you are referring to, see

@sereshqua
Copy link

@fanifieiev ping

@fanifieiev
Copy link
Contributor Author

@sereshqua

  1. I was the problem reporter and problem solver at the same time, but I was not part of this project at that time. When I created the problem, I was assigned by @paulodamaso to solve it. I did not know the rules then.

  2. How should the problem be closed ?
    I was asked by reviewer @victornoel to close it manually, see

@sereshqua
Copy link

@fanifieiev

  1. it is a policy rule and 0crat shows that the job has been completed by you, see

  2. you need to start EVERY single comment in both issues & PRs with the name of the person your referring to.

@sereshqua
Copy link

@0crat quality acceptable

@0crat
Copy link
Collaborator

0crat commented Oct 15, 2019

Order was finished, quality is "acceptable": +30 point(s) just awarded to @fanifieiev/z

@0crat
Copy link
Collaborator

0crat commented Oct 15, 2019

Quality review completed: +4 point(s) just awarded to @sereshqua/z

@fanifieiev
Copy link
Contributor Author

@fanifieiev

  1. it is a policy rule and 0crat shows that the job has been completed by you, see
  2. you need to start EVERY single comment in both issues & PRs with the name of the person your referring to.

@sereshqua Got it, will do next time.

@0pdd
Copy link
Collaborator

0pdd commented Nov 3, 2019

@fanifieiev the puzzle #1194 is still not solved; solved: #1191, #1192, #1193.

@0pdd
Copy link
Collaborator

0pdd commented Jan 13, 2020

@fanifieiev all 4 puzzles are solved here: #1191, #1192, #1193, #1194.

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

7 participants