{"id":18207448,"url":"https://github.com/goswinr/resizearray","last_synced_at":"2025-04-02T16:31:09.181Z","repository":{"id":218530719,"uuid":"746739021","full_name":"goswinr/ResizeArray","owner":"goswinr","description":"An F# extension and module library for ResizeArray\u003c'T\u003e","archived":false,"fork":false,"pushed_at":"2025-03-15T11:50:10.000Z","size":319,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-15T12:29:26.056Z","etag":null,"topics":["array","fable","fsharp","library","list"],"latest_commit_sha":null,"homepage":"https://goswinr.github.io/ResizeArray/","language":"F#","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/goswinr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-22T15:23:52.000Z","updated_at":"2025-03-15T11:50:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"b8e5d953-ea97-494a-9703-df0e403a7b4d","html_url":"https://github.com/goswinr/ResizeArray","commit_stats":null,"previous_names":["goswinr/resizearray"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goswinr%2FResizeArray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goswinr%2FResizeArray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goswinr%2FResizeArray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goswinr%2FResizeArray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goswinr","download_url":"https://codeload.github.com/goswinr/ResizeArray/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246850859,"owners_count":20844156,"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","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","fable","fsharp","library","list"],"created_at":"2024-11-03T13:02:54.410Z","updated_at":"2025-04-02T16:31:09.175Z","avatar_url":"https://github.com/goswinr.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\r\n![Logo](https://raw.githubusercontent.com/goswinr/ResizeArray/main/Docs/img/logo128.png)\r\n# ResizeArray\r\n\r\n[![ResizeArray on nuget.org](https://img.shields.io/nuget/v/ResizeArray)](https://www.nuget.org/packages/ResizeArray/)\r\n[![Build Status](https://github.com/goswinr/ResizeArray/actions/workflows/build.yml/badge.svg)](https://github.com/goswinr/ResizeArray/actions/workflows/build.yml)\r\n[![Docs Build Status](https://github.com/goswinr/ResizeArray/actions/workflows/docs.yml/badge.svg)](https://github.com/goswinr/ResizeArray/actions/workflows/docs.yml)\r\n[![Test Status](https://github.com/goswinr/ResizeArray/actions/workflows/test.yml/badge.svg)](https://github.com/goswinr/ResizeArray/actions/workflows/test.yml)\r\n[![license](https://img.shields.io/github/license/goswinr/ResizeArray)](LICENSE.md)\r\n![code size](https://img.shields.io/github/languages/code-size/goswinr/ResizeArray.svg)\r\n\r\n\r\nResizeArray is an F# extension and module library for `ResizeArray\u003c'T\u003e` ( = `Collection.Generic.List\u003c'T\u003e`).\u003cbr\u003e\r\nIt provides all the functions from the `Array` module in `FSharp.Core` for `ResizeArray`.\u003cbr\u003e\r\nAnd more.\r\n\r\nIt also works in Javascript and Typescript with [Fable](https://fable.io/).\r\n\r\nThis library was designed for use with F# scripting.\u003cbr\u003e\r\nFunctions and methods never return null.\u003cbr\u003e\r\nWhen a function fails on invalid input it will throw a descriptive exception.\u003cbr\u003e\r\nFunctions starting with `try...` will return an F# option.\r\n\r\nI was always annoyed that an `IndexOutOfRangeException` does not include the actual bad index nor the actual size of the array.\u003cbr\u003e\r\nThis library fixes that in `resizeArray.Get`, `resizeArray.Set`, `resizeArray.Slice` and all other item access functions.\u003cbr\u003e\r\nI made a similar a similar library for `array\u003c'T\u003e`: https://github.com/goswinr/ArrayT/ .\r\n\r\n### Why ?\r\nYes, F#'s array and list modules can do these kind of operations on collections too.\u003cbr\u003e\r\nBut ResizeArray (being mutable)  still offers the best performance for collections that can expand \u0026 shrink and need random access via an index.\u003cbr\u003e\r\nIn fact FSharp.Core uses [a very similar module internally](https://github.com/dotnet/fsharp/blob/main/src/Compiler/Utilities/ResizeArray.fs).\r\n\r\n### It Includes:\r\n\r\n- A `ResizeArray` module that has  **all**  functions from [`Array` module from `FSharp.Core`] reimplemented (https://fsharp.github.io/fsharp-core-docs/reference/fsharp-collections-arraymodule.html).\u003cbr\u003e\r\n Including the sub module for Parallel computing.\r\n\r\n- A  Computational Expressions `resizeArray` that can be used like existing ones for `seq`.\r\n\r\n- Support for F# slicing operator and indexing from the end. e.g: `items.[ 1 .. ^1]`.\r\n\r\n- Extension members on `ResizeArray` like `.Get` `.Set` `.First` `.Last` `.SecondLast` and more.\u003cbr\u003e\r\nWith nicer IndexOutOfRangeExceptions that include the bad index and the actual size.\r\n\r\n- All Tests from the from `FSharp.Core`'s `Array` module ported and adapted to run in both javascript and dotnet.\r\n\r\n\r\n\r\n### Usage\r\nJust open the namespace\r\n\r\n```fsharp\r\nopen ResizeArray\r\n```\r\nthis namespace contains:\r\n- a module also called `ResizeArray`\r\n- a  Computational Expressions called `resizeArray`\r\n- this will also auto open the extension members on `ResizeArray\u003c'T\u003e`\r\n\r\nthen you can do:\r\n\r\n```fsharp\r\nlet evenNumbers =\r\n    resizeArray {  // a Computational Expressions like seq\r\n        for i = 0 t 99 do\r\n            if i % 2 = 0 then\r\n                i\r\n    }\r\n\r\nlet oddNumbers = evenNumbers |\u003e ResizeArray.map (fun x -\u003e x + 1) // ResizeArray module\r\n\r\nlet hundred = oddNumbers.Last // Extension member to access the last item in list\r\n\r\n```\r\n\r\n### Full API Documentation\r\n\r\n[goswinr.github.io/ResizeArray](https://goswinr.github.io/ResizeArray/reference/resizearray.html)\r\n\r\n\r\n### Tests\r\nAll Tests run in both javascript and dotnet.\r\nSuccessful Fable compilation to typescript is verified too.\r\nGo to the tests folder:\r\n\r\n```bash\r\ncd Tests\r\n```\r\n\r\nFor testing with .NET using Expecto:\r\n\r\n```bash\r\ndotnet run\r\n```\r\n\r\nfor JS testing with Fable.Mocha and TS verification:\r\n\r\n```bash\r\nnpm test\r\n```\r\n\r\n### License\r\n[MIT](https://github.com/goswinr/ResizeArray/blob/main/LICENSE.md)\r\n\r\n### Changelog\r\nsee [CHANGELOG.md](https://github.com/goswinr/ResizeArray/blob/main/CHANGELOG.md)\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoswinr%2Fresizearray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoswinr%2Fresizearray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoswinr%2Fresizearray/lists"}