{"id":20506363,"url":"https://github.com/delta456/range","last_synced_at":"2025-07-23T01:33:03.946Z","repository":{"id":55408009,"uuid":"266975198","full_name":"Delta456/range","owner":"Delta456","description":"Functionality of Python's range() in V ","archived":false,"fork":false,"pushed_at":"2023-03-19T15:40:22.000Z","size":18,"stargazers_count":33,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-13T21:42:17.284Z","etag":null,"topics":["array","python","range","vlang"],"latest_commit_sha":null,"homepage":"","language":"V","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Delta456.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-05-26T07:33:30.000Z","updated_at":"2024-07-30T00:25:39.000Z","dependencies_parsed_at":"2024-01-27T09:38:38.859Z","dependency_job_id":"5c102957-2d18-408d-a8f6-b36c04ec39d2","html_url":"https://github.com/Delta456/range","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Delta456/range","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Delta456%2Frange","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Delta456%2Frange/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Delta456%2Frange/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Delta456%2Frange/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Delta456","download_url":"https://codeload.github.com/Delta456/range/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Delta456%2Frange/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266602801,"owners_count":23954696,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["array","python","range","vlang"],"created_at":"2024-11-15T19:56:36.901Z","updated_at":"2025-07-23T01:33:03.921Z","avatar_url":"https://github.com/Delta456.png","language":"V","funding_links":[],"categories":[],"sub_categories":[],"readme":"# range\n\nNumeric ranges in V.\n\n## Why\n\n- `a..b` in V can only be in increasing order and not in negative order.\n- Lacks inbuilt `step` which most people need or want.\n- No support for `float` type.\n- Solution for [vlang/v#5944](https://github.com/vlang/v/issues/5944).\n\n## Features\n\n- Make `range` easily\n- Make ranges for `int` and `f32`\n- Positive as well as negative support!\n- No need to write the whole for loop! (*this maybe slower than the normal one*)\n- Use `range` for functional programming\n- Support iterators. Long ranges without high memory allocation.\n- Half open-open ranges `[from,to]`\n\n## Installation\n\n- Via `git clone`\n    - `git clone https://github.com/Delta456/range`\n- Via `v install`\n    - `v install Delta456.range`\n- Via `vpkg`\n    - `vpkg install range`\n\n## Usage\n\nUse an iterator if you need a large range but don't want to allocate space in memory for all numbers in the range.\n\n```v\nimport delta456.range\n\nmut iter := range.to_iterator(from: 0, to: 1000000, step: 2)\nfor v in iter {\n  println(v)\n}\n```\n\n```\n$ v run main.v\n0\n2\n4\n```\n\nUse an array when you need it and the memory allocation for all values in the range is not a problem.\n\n```v\nimport delta456.range\n\narr := range.to_array(from: 10, to: 0, step: -1)\nprintln(arr)\n```\n\n```\nv run main.v\n[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]\n```\n\nIf you prefer you can use the builder syntax.\n\n```v\nmut iter := range.new[int]().from(0).to(10).step(1).to_iterator()\n\n// or\n\narr := range.new[int]().from(0).to(10).step(1).to_array()\n\n// or\n\nmut iter := range.Builder[int]{ from: 0, to: 10, step: 1 }.to_iterator()\n\n// or\n\narr := range.Builder[int]{ from: 0, to: 10, step: 1 }.to_array()\n```\n\nThe builder is immutable! You can reuse it as many times as you want.\n\n```v\nzero_to_nine := range.new[int]().from(0).to(10).step(1)\n\n// print from 0 to 9\nfor v in zero_to_nine.to_iterator() {\n  println(v)\n}\n\n// print from 0 to 9 again, no problems\nfor v in zero_to_nine.to_iterator() {\n  println(v)\n}\n```\n\n## License\n\nReleased under [MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelta456%2Frange","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdelta456%2Frange","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdelta456%2Frange/lists"}