Personally, I think that the names are excessively short and confusing.
`first_elem` and `second_elem` would be more meaningful.

-a

On Sun, May 21, 2023 at 9:06 PM Vinícius Müller <vinigm....@gmail.com>
wrote:

> Currently it is necessary to do `|> &elem(&1, 1)` or `|> &elem(&1, 2)`
> when trying to get a specific element of a tuple in a pipeline or normally.
>
> F#[0], Haskell[1], Ocaml[2] and other functional languages have the `fst`
> and `snd` functions, which simply extract the first and second elements of
> a tuple, respectively.
>
> I think it would make some code samples simpler, since it reads much
> better, I guess it's the same idea as using `|> hd()` rather than doing `|>
> fn [h | _] -> h end`.
>
> Does this makes sense for Elixir? If so, I'm willing to implement it.
>
> [0]:
> https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/tuples#obtaining-individual-values
> [1]:
> https://hackage.haskell.org/package/base-4.18.0.0/docs/Prelude.html#g:3
> [2]: https://v2.ocaml.org/api/Stdlib.html
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/8c965a60-d8a5-4384-aeb4-182a86c085bbn%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/8c965a60-d8a5-4384-aeb4-182a86c085bbn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Austin Ziegler • halosta...@gmail.com • aus...@halostatue.ca
http://www.halostatue.ca/http://twitter.com/halostatue

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAJ4ekQuJpfZkqdVQZvvOct%2B-XZBdvT-3MySa8zgSimia1bYWSQ%40mail.gmail.com.

Reply via email to