> It was pointed out that perhaps we don't do this to express that indexing a > list is not fast in Elixir like it is in other languages, but I'm not sure if > that is sufficient reason IMO to leave out a typically very standard feature > of lists. > > Thoughts?
Can you give an example of a language that supports this? In my experience, languages do not provide this. In Haskell, you need to the non-standard !! operator. myList !! 5 OCaml does not provide a way to do this at all and you need to manually iterate through the list to find the element you want (maybe other stdlibs like Core provide something, but I have not used them) Racket has the list-ref function in order to accomplish this (list-ref my-list 3) Common Lisp has the nth function for this (nth 5 my-list) In comparison, Elixir has provided the Enum.at/2 function. While I believe most languages do provide some facility to retrieve the value at some index of a list, most do not provide it as square bracket indexing you would see in other languages where arrays are more common such as Ruby or Javascript. Justin -- 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/dc142043-83dc-48e6-8c3f-7a39c8376d0e%40app.fastmail.com.