--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/69a0953e-07b3-4cc6-8cc0-bee718337ea5%40googlegroups.com.
Also hd, which takes the head of the list.
On Thu, Apr 20, 2017 at 12:44 PM, OvermindDL1 <overm...@gmail.com> wrote:
Two things:1. The `List` module already has a `List.first/1`.2. Not all enumerables have a concept of ordering, like a map, so I'm not sure an Enum version of such a thing makes conceptual sense?
On Thursday, April 20, 2017 at 10:33:11 AM UTC-6, Sam Davies wrote:When working with collections it's often convenient to grab the first element that comes to hand. I find myself writing this a lot:
`Enum.take(collection, 1)` or `Enum.at(collection, 0)`
How about a function `Enum.take/1` which takes only the collection and returns the "first" value (I avoid naming it `Enum.first/1` since some collections may not have any concept of ordering).
--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/bd395d6b-e64d-41ef-970e-8ac33c0e279c%40googlegroups.com.
======================================================= I welcome VSRE emails. Learn more at http://vsre.info/ =======================================================
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/9123abef-0f2a-47a8-8e93-69626f9515b2%40googlegroups.com.To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/d0ca1a3f-56e4-430b-9ed7-80d225f4d01f%40googlegroups.com.
You could make the same argument for `List.first(x)`. Why use that when we already have `Enum.at(x, 0)` ?