{"action":"created","issue":{"url":"https://api.github.com/repos/hylang/hy/issues/963","labels_url":"https://api.github.com/repos/hylang/hy/issues/963/labels{/name}","comments_url":"https://api.github.com/repos/hylang/hy/issues/963/comments","events_url":"https://api.github.com/repos/hylang/hy/issues/963/events","html_url":"https://github.com/hylang/hy/issues/963","id":111307770,"number":963,"title":"Consider making collections \"callable\"","user":{"login":"gilch","id":3346292,"avatar_url":"https://avatars.githubusercontent.com/u/3346292?v=3","gravatar_id":"","url":"https://api.github.com/users/gilch","html_url":"https://github.com/gilch","followers_url":"https://api.github.com/users/gilch/followers","following_url":"https://api.github.com/users/gilch/following{/other_user}","gists_url":"https://api.github.com/users/gilch/gists{/gist_id}","starred_url":"https://api.github.com/users/gilch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gilch/subscriptions","organizations_url":"https://api.github.com/users/gilch/orgs","repos_url":"https://api.github.com/users/gilch/repos","events_url":"https://api.github.com/users/gilch/events{/privacy}","received_events_url":"https://api.github.com/users/gilch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-14T02:18:23Z","updated_at":"2015-10-14T13:41:56Z","closed_at":null,"body":"Clojure does this for its basic collections. I'm proposing Hy do this for anything with a `__getitem__` method that isn't already a Python callable, like we already do for keywords. This way it will also work for custom types that support the getitem interface. In the rare case that your collection is also a Python callable, you still have to use the `(get)` special form explicitly.\r\n\r\n```Hy\r\n=> ([1 2 3 4] 1)\r\n2\r\n=> ({1 2 3 4} 1)\r\n2\r\n=> (\"1234\" (slice 2))\r\n'12'\r\n```\r\nThat last one would be especially nice with the slice literals I proposed in #541:\r\n```Hy\r\n=> (\"1234\" :[1 3])\r\n'23'\r\n```"},"comment":{"url":"https://api.github.com/repos/hylang/hy/issues/comments/148052684","html_url":"https://github.com/hylang/hy/issues/963#issuecomment-148052684","issue_url":"https://api.github.com/repos/hylang/hy/issues/963","id":148052684,"user":{"login":"kirbyfan64","id":1690697,"avatar_url":"https://avatars.githubusercontent.com/u/1690697?v=3","gravatar_id":"","url":"https://api.github.com/users/kirbyfan64","html_url":"https://github.com/kirbyfan64","followers_url":"https://api.github.com/users/kirbyfan64/followers","following_url":"https://api.github.com/users/kirbyfan64/following{/other_user}","gists_url":"https://api.github.com/users/kirbyfan64/gists{/gist_id}","starred_url":"https://api.github.com/users/kirbyfan64/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kirbyfan64/subscriptions","organizations_url":"https://api.github.com/users/kirbyfan64/orgs","repos_url":"https://api.github.com/users/kirbyfan64/repos","events_url":"https://api.github.com/users/kirbyfan64/events{/privacy}","received_events_url":"https://api.github.com/users/kirbyfan64/received_events","type":"User","site_admin":false},"created_at":"2015-10-14T13:41:56Z","updated_at":"2015-10-14T13:41:56Z","body":"Wouldn't this require wrapping every single function call to test for `__getitem__`? That would likely be a *major* speed issue for little gain.\r\n\r\nI think a better solution would be to have *curried operators*. Basically, for `get`, there would be a curried version `getc` or something like that. That way, you could do `(getc [1 2 3])` to create an indexing callable."}}