Ichoran

Results 92 comments of Ichoran

Anyway, I think it's oft-missed functionality, so it should go in under some name.

I guess the deeper question is: what is the point of `tail` at all? `drop(1)` is the safe way to do it, and the return type is the same. Throwing...

> I think my favorite implementation so far is `util.Try(vector.tail)` followed by `.toOption` or `.getOrElse(Vector.empty)`, since it's the one I can most easily read over without worrying about the implementation...

I agree that for completeness `tailOption` and `initOption` are a good idea, as safe alternatives to the unsafe `tail` and `init`, to parallel `headOption` and `lastOption`. And certainly the `tail`...

> In fact, I would say I'm advocating for `tail` failing if there is a single element in a collection, but I understand that would be shocking for existing users,...

This seems like the kind of thing that should go into a random number library, not a collections library. Seems awfully specialized. What if you want to choose `k` of...

@BalmungSan - I didn't mention `shuffle` because I thought you should implement selection with shuffle! I just mentioned it because it indicates that `Random` is a natural home for methods...

Yeah, rather than using a default argument, I'd recommend `sample(coll): A` but `sample(coll, n): Coll[A]` would make sense. In the spirit of safe operations by default, if you ask for...

@BalmungSan - I implemented something for arrays which generalizes fine to `IndexedSeq`. Then for things that aren't arrays, I implemented Algorithm L which doesn't even need to know how big...

@amitainz - You could try to transition to using Java 8 Streams. Although they don't support every possible collection, they generally perform quite well, and there are adapters for the...