Re: [elixir-core:7080] Re: Proposal: Enum.take/1

2017-04-25 Thread Sam Davies
I like `Enum.one/1`. Agree that it's confusing to have `take/1` return a single element and `take/2` returning a list, although Rails' `take` works like this. If the collection is empty it returns nil naturally. A bang and non-bang version could work, this would make it work like Ecto's `one/2`

Re: [elixir-core:7080] Re: Proposal: Enum.take/1

2017-04-25 Thread Amos King
"Sins of the father." - I prefer consistency to having `take` return two different result types. I think that `Enum.one\2` is a much better idea. I expect the second argument to default to nil and allow a default to be passed in. There is a difference between verbose and explicit. Ruby's each is