{"id":19596865,"url":"https://github.com/cdiggins/plato.collections","last_synced_at":"2025-07-14T16:38:52.922Z","repository":{"id":189524190,"uuid":"607756160","full_name":"cdiggins/Plato.Collections","owner":"cdiggins","description":"A library of immutable abstract data types inspired by LINQ. ","archived":false,"fork":false,"pushed_at":"2023-04-24T21:43:36.000Z","size":34,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-09T07:31:38.602Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","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/cdiggins.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}},"created_at":"2023-02-28T16:03:56.000Z","updated_at":"2023-03-02T20:00:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"c468a7c2-a1da-45f5-b466-f270f65962e7","html_url":"https://github.com/cdiggins/Plato.Collections","commit_stats":null,"previous_names":["cdiggins/plato.collections"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdiggins%2FPlato.Collections","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdiggins%2FPlato.Collections/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdiggins%2FPlato.Collections/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cdiggins%2FPlato.Collections/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cdiggins","download_url":"https://codeload.github.com/cdiggins/Plato.Collections/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240876832,"owners_count":19871904,"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":[],"created_at":"2024-11-11T08:56:58.279Z","updated_at":"2025-02-26T14:46:50.688Z","avatar_url":"https://github.com/cdiggins.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Plato.Collections\n\nA library of immutable abstract data types inspired by LINQ. \nPlato.Collections is built in Platonic C# and is fully compatible with .NET Standard 2.0. \n\n## Platonic C# \n\nPlatonic C# is a set of coding guidelines for using C# that enable data structures and algorithms to be machine translated into the Plato language. \nPlato is being developed as a high-performance pure functional language that can target multiple platforms. \n\n## Design Principles\n\nPlato.Collections is designed starting from simple generic immutable interfaces, with a rich library extension methods, and factory functions.\n\n1. All collections are immutable, side-effect free, and thread-safe. \n1. Simplicity is chosen over performance \n1. Required API for an Interfaces should each be as small as possible\n1. Each interface should describe a single well-defined concept \n1. Data types with different algorithmic complexity need different representations \n1. Low-level performance concerns beyond should be primarily the concern of optimization tools  \n\n## ISequence versis IEnumerable \n\nThe `System.IEnumerable\u003cT\u003e` interface represents a potentially mutable type and has the following interfaces:\n\n```csharp\ninterface IEnumerable\u003cT\u003e \n{\n    IEnumerator\u003cT\u003e GetEnumerator();\n}\n```\n\nThe `Plato.ISequence\u003cT\u003e` type is quite similar, but only represents immutable types. One of the advantages\nof an `ISequence` is that it can safely be enumerated multiple times, and has a hard guarantee of never \nchanging under. \n\n```csharp\ninterface ISequence\u003cT\u003e \n{\n    IIterator\u003cT\u003e Iterator { get; } \n}\n```\n\nThe `IIterator\u003cT\u003e` type returned from the `Iterator` property, is also an immutable type unlike `IEnumerable`. \nThis affords several advantages such as the fact that a collection of iterators can be safely made representing different \nlocations in a sequence.  \n\n## IIterator versus IEnumerator \n\nThe `System.IEnumerator\u003cT\u003e` interface represents a mutable type and has the following interfaces:\n\n```csharp\ninterface IEnumerator\u003cT\u003e \n{    \n    T Current { get; }\n    bool MoveNext(); \n    void Reset();\n    void Dispose();\n}\n```\n\nThe comparable interface `Plato.IIterator\u003cT\u003e` on the other hand is immutable and has the following interface: \n\n```csharp\ninterface IIterator\u003cT\u003e \n{    \n    T Value { get; }\n    bool HasValue { get; }\n    IIterator\u003cT\u003e Next { get; }\n}\n```\n\nNotice that `IIterator\u003cT\u003e` cannot be disposed, nor can it be reset. Unlike the `IEnumerator` \nit is initialized to point to the first element in a sequence, as opposed to pointing to a location before the \nfirst spot (`IEnumerator` requires an initial call to `MoveNext()` before values can be retrieved). \n\n\n## IArray vs LINQ on Array\n\nThe `Plato.IArray` interface provides a read-only interface to arrays.\nUnlike `Plato.ISequence` or `System.IEnumerable`, many of the `IArray` operations \nreturn an `IArray`, which retains algorithmic complexity O(1) for \nquerying the count, or random access of elements. \n\n```csharp\ninterface IArray\u003cT\u003e \n{\n    int Count { get; }\n    this[int n] { get; }\n}\n```\n\nThe `IArray\u003cT\u003e` implementation is based on the [LinqArray](https://github.com/vimaec/LinqArray) library, which in turn\nis based on article at CodeProject.com called [LINQ for Immutable Arrays](https://www.codeproject.com/Articles/517728/LINQ-for-Immutable-Arrays). \n\n## Additional Data Types \n\nSome of the additional types provided by Plato.Collections library includes:\n\n* `ICountedSequence\u003cT\u003e`\n* `ISet\u003cT\u003e` \n* `IQueue\u003cTKey\u003e`\n* `IDequeue\u003cTKey\u003e`\n* `IStack\u003cTKey\u003e`\n* `IHeap\u003cTKey\u003e`\n* `IDictionary\u003cTKey, TValue\u003e`\n* `IMultiDictionary\u003cTKey, TValue\u003e`\n* `IBiDictionary\u003cTKey, TValue\u003e`\n\n\u003c!--\n## Dependencies \n\nTODO.\n\n## ISequence versus IEnumerable \n\nTODO.\n\n## Pure Functional Data Structures \n\nTODO.\n\n## Immutable Data Structures \n\nTODO.\n\n## Mutable Data Structures \n\nTODO.\n\n## History\n\nTODO.\n--\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdiggins%2Fplato.collections","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcdiggins%2Fplato.collections","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcdiggins%2Fplato.collections/lists"}