{"action":"created","issue":{"url":"https://api.github.com/repos/calmm-js/partial.lenses/issues/180","repository_url":"https://api.github.com/repos/calmm-js/partial.lenses","labels_url":"https://api.github.com/repos/calmm-js/partial.lenses/issues/180/labels{/name}","comments_url":"https://api.github.com/repos/calmm-js/partial.lenses/issues/180/comments","events_url":"https://api.github.com/repos/calmm-js/partial.lenses/issues/180/events","html_url":"https://github.com/calmm-js/partial.lenses/issues/180","id":341909265,"node_id":"MDU6SXNzdWUzNDE5MDkyNjU=","number":180,"title":"Index isomorphism","user":{"login":"shtanton","id":23153517,"node_id":"MDQ6VXNlcjIzMTUzNTE3","avatar_url":"https://avatars2.githubusercontent.com/u/23153517?v=4","gravatar_id":"","url":"https://api.github.com/users/shtanton","html_url":"https://github.com/shtanton","followers_url":"https://api.github.com/users/shtanton/followers","following_url":"https://api.github.com/users/shtanton/following{/other_user}","gists_url":"https://api.github.com/users/shtanton/gists{/gist_id}","starred_url":"https://api.github.com/users/shtanton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shtanton/subscriptions","organizations_url":"https://api.github.com/users/shtanton/orgs","repos_url":"https://api.github.com/users/shtanton/repos","events_url":"https://api.github.com/users/shtanton/events{/privacy}","received_events_url":"https://api.github.com/users/shtanton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-07-17T13:01:09Z","updated_at":"2018-07-20T12:42:15Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Not sure if this has been suggested before or even if it is already implemented (neither as far as I can tell), but I think a useful function could take an array as a parameter, and return an isomorphism that goes between a value and its index in that array.\r\n\r\nObviously there would need to be some logic dictating what to do if the value isn't in the array or if the index is invalid.\r\n\r\nIf this is a good idea I would be happy to have a go at creating a PR for it\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/calmm-js/partial.lenses/issues/comments/406589207","html_url":"https://github.com/calmm-js/partial.lenses/issues/180#issuecomment-406589207","issue_url":"https://api.github.com/repos/calmm-js/partial.lenses/issues/180","id":406589207,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjU4OTIwNw==","user":{"login":"shtanton","id":23153517,"node_id":"MDQ6VXNlcjIzMTUzNTE3","avatar_url":"https://avatars2.githubusercontent.com/u/23153517?v=4","gravatar_id":"","url":"https://api.github.com/users/shtanton","html_url":"https://github.com/shtanton","followers_url":"https://api.github.com/users/shtanton/followers","following_url":"https://api.github.com/users/shtanton/following{/other_user}","gists_url":"https://api.github.com/users/shtanton/gists{/gist_id}","starred_url":"https://api.github.com/users/shtanton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shtanton/subscriptions","organizations_url":"https://api.github.com/users/shtanton/orgs","repos_url":"https://api.github.com/users/shtanton/repos","events_url":"https://api.github.com/users/shtanton/events{/privacy}","received_events_url":"https://api.github.com/users/shtanton/received_events","type":"User","site_admin":false},"created_at":"2018-07-20T12:42:15Z","updated_at":"2018-07-20T12:42:15Z","author_association":"CONTRIBUTOR","body":"Thanks for the detailed response, I hadn't thought of composing `find` and `is` to produce the same result as the contains lens, because it can be so easily produced from existing lenses, it's probably not worth adding it as its own lens.\r\n\r\nMy use case for the index isomorphism was to show a list of items, and have elsewhere a form that involves selecting using the index of the list item.  It doesn't really require the use of lenses but I thought it would be more fun this way.  I expect that most of the time, it is better to store the index as state instead of the item itself as `indexOf` might be quite slow for large arrays, which I think would limit its usefulness."}}
{"actor":{"display_login":"shtanton"}}