{"action":"created","issue":{"url":"https://api.github.com/repos/openscad/openscad/issues/1583","repository_url":"https://api.github.com/repos/openscad/openscad","labels_url":"https://api.github.com/repos/openscad/openscad/issues/1583/labels{/name}","comments_url":"https://api.github.com/repos/openscad/openscad/issues/1583/comments","events_url":"https://api.github.com/repos/openscad/openscad/issues/1583/events","html_url":"https://github.com/openscad/openscad/issues/1583","id":134303767,"number":1583,"title":"Generalized ranges","user":{"login":"doug-moen","id":5274273,"avatar_url":"https://avatars.githubusercontent.com/u/5274273?v=3","gravatar_id":"","url":"https://api.github.com/users/doug-moen","html_url":"https://github.com/doug-moen","followers_url":"https://api.github.com/users/doug-moen/followers","following_url":"https://api.github.com/users/doug-moen/following{/other_user}","gists_url":"https://api.github.com/users/doug-moen/gists{/gist_id}","starred_url":"https://api.github.com/users/doug-moen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doug-moen/subscriptions","organizations_url":"https://api.github.com/users/doug-moen/orgs","repos_url":"https://api.github.com/users/doug-moen/repos","events_url":"https://api.github.com/users/doug-moen/events{/privacy}","received_events_url":"https://api.github.com/users/doug-moen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/openscad/openscad/labels/New%20Feature","name":"New Feature","color":"02e10c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":27,"created_at":"2016-02-17T15:03:25Z","updated_at":"2016-02-23T11:07:31Z","closed_at":null,"body":"The goal is to make ranges more useful. We'll simplify and generalize the language, by making the existing range notation just an alternate way of specifying a list.\r\n1. Let's modify the behaviour of ranges, so that they behave like lists in all contexts.\r\n2. Let's support the range syntax `a:b` and `a:b:c` as a 'generator' element of a list comprehension.\r\n\r\nTo modify the behaviour of ranges, let's make the following changes. Given `R=[0:3]`:\r\n* `len` returns the number of elements in the range's sequence. Eg, `len(R)==4`\r\n* `R[i]` returns the i'th element of the range's sequence. Eg, `R[3]==3`\r\n* `concat` treats the range as if it were a list. Eg, `concat(R,[10,20])==[0,1,2,3,10,20]`\r\n* If #1584 type test functions is implemented, then `is_list` should return true for a range.\r\n* In general, all built-in operations treat a range as if it were a list.\r\n\r\nList comprehension syntax is extended so that one of the comma-separated elements of a list comprehension can be a range specifier. For example, `[1,1:3,5,8]` == `[1,1,2,3,5,8]`."},"comment":{"url":"https://api.github.com/repos/openscad/openscad/issues/comments/187655169","html_url":"https://github.com/openscad/openscad/issues/1583#issuecomment-187655169","issue_url":"https://api.github.com/repos/openscad/openscad/issues/1583","id":187655169,"user":{"login":"GilesBathgate","id":444143,"avatar_url":"https://avatars.githubusercontent.com/u/444143?v=3","gravatar_id":"","url":"https://api.github.com/users/GilesBathgate","html_url":"https://github.com/GilesBathgate","followers_url":"https://api.github.com/users/GilesBathgate/followers","following_url":"https://api.github.com/users/GilesBathgate/following{/other_user}","gists_url":"https://api.github.com/users/GilesBathgate/gists{/gist_id}","starred_url":"https://api.github.com/users/GilesBathgate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GilesBathgate/subscriptions","organizations_url":"https://api.github.com/users/GilesBathgate/orgs","repos_url":"https://api.github.com/users/GilesBathgate/repos","events_url":"https://api.github.com/users/GilesBathgate/events{/privacy}","received_events_url":"https://api.github.com/users/GilesBathgate/received_events","type":"User","site_admin":false},"created_at":"2016-02-23T11:07:31Z","updated_at":"2016-02-23T11:07:31Z","body":"@doug-moen It would break\r\n\r\n[1:3].x==undef;\r\nI am not saying that's a bad thing, but it could still be something that someone was depending on."}}