{"action":"created","issue":{"url":"https://api.github.com/repos/elixir-lang/elixir/issues/3853","labels_url":"https://api.github.com/repos/elixir-lang/elixir/issues/3853/labels{/name}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/issues/3853/comments","events_url":"https://api.github.com/repos/elixir-lang/elixir/issues/3853/events","html_url":"https://github.com/elixir-lang/elixir/issues/3853","id":110464871,"number":3853,"title":"Dict.size/1 should not work on Lists","user":{"login":"rebelwarrior","id":839013,"avatar_url":"https://avatars.githubusercontent.com/u/839013?v=3","gravatar_id":"","url":"https://api.github.com/users/rebelwarrior","html_url":"https://github.com/rebelwarrior","followers_url":"https://api.github.com/users/rebelwarrior/followers","following_url":"https://api.github.com/users/rebelwarrior/following{/other_user}","gists_url":"https://api.github.com/users/rebelwarrior/gists{/gist_id}","starred_url":"https://api.github.com/users/rebelwarrior/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rebelwarrior/subscriptions","organizations_url":"https://api.github.com/users/rebelwarrior/orgs","repos_url":"https://api.github.com/users/rebelwarrior/repos","events_url":"https://api.github.com/users/rebelwarrior/events{/privacy}","received_events_url":"https://api.github.com/users/rebelwarrior/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-10-08T14:33:29Z","updated_at":"2015-10-09T02:53:34Z","closed_at":null,"body":"First, The following code should not work but does:\r\n\r\n```elixir\r\nDict.size([1,2,3,4,5,6,7,8,9,0])   #=>10\r\n```\r\nAccording to Jose Valim Lists are not Dicts so this shouldn't work. The correct use would be with `Enum.count/1`\r\n\r\n```elixir\r\nEnum.count([1,2,3,4,5,6,7,8,9,0])   #=>10\r\n```\r\n\r\n~~Secondly, since an alias for `Enum.count/1` should be made to `Enum.size/1` to allow for easier discoverability on the documentation, as a search for 'size' will point you to the `Dict.size\\1` function.~~"},"comment":{"url":"https://api.github.com/repos/elixir-lang/elixir/issues/comments/146741170","html_url":"https://github.com/elixir-lang/elixir/issues/3853#issuecomment-146741170","issue_url":"https://api.github.com/repos/elixir-lang/elixir/issues/3853","id":146741170,"user":{"login":"ericmj","id":316890,"avatar_url":"https://avatars.githubusercontent.com/u/316890?v=3","gravatar_id":"","url":"https://api.github.com/users/ericmj","html_url":"https://github.com/ericmj","followers_url":"https://api.github.com/users/ericmj/followers","following_url":"https://api.github.com/users/ericmj/following{/other_user}","gists_url":"https://api.github.com/users/ericmj/gists{/gist_id}","starred_url":"https://api.github.com/users/ericmj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericmj/subscriptions","organizations_url":"https://api.github.com/users/ericmj/orgs","repos_url":"https://api.github.com/users/ericmj/repos","events_url":"https://api.github.com/users/ericmj/events{/privacy}","received_events_url":"https://api.github.com/users/ericmj/received_events","type":"User","site_admin":false},"created_at":"2015-10-09T02:53:34Z","updated_at":"2015-10-09T02:53:34Z","body":"> It seems Keyword.size just does length(keyword), so no constant time in that case\r\n\r\nThe common case is constant time, hence the name.\r\n\r\n> I had not found lenght() yet and it works fantastically (plus seems tailor made for lists). A List.length() alias would be a good idea for discoverability. Otherwise if you don't know length() exist, it's a little hard to find. With it being part of List, it would show up on iex when you hit tab. It would also be distinct semantically from size or count.\r\n\r\nElixir doesn't alias functions for discoverability. Searching for `length` in the documentation would find it. Learning a language is in part learning its conventions, when you learn the conventions around `length`, `count` and `size` you will have an easy time finding the functions later on."}}