{"id":16687968,"url":"https://github.com/danielpclark/digits","last_synced_at":"2025-04-10T00:32:57.044Z","repository":{"id":57619289,"uuid":"95998082","full_name":"danielpclark/digits","owner":"danielpclark","description":"Custom numeric bases written as linked lists and additive Mathematics reaching “to infinity, and beyond”.","archived":false,"fork":false,"pushed_at":"2022-05-16T00:53:12.000Z","size":79,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-02T16:25:34.653Z","etag":null,"topics":["character","digit","mathematics","rust","sequence"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/danielpclark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-02T02:35:39.000Z","updated_at":"2022-05-16T00:52:39.000Z","dependencies_parsed_at":"2022-09-14T12:41:55.738Z","dependency_job_id":null,"html_url":"https://github.com/danielpclark/digits","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielpclark%2Fdigits","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielpclark%2Fdigits/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielpclark%2Fdigits/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielpclark%2Fdigits/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielpclark","download_url":"https://codeload.github.com/danielpclark/digits/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239088383,"owners_count":19579432,"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":["character","digit","mathematics","rust","sequence"],"created_at":"2024-10-12T15:26:13.229Z","updated_at":"2025-02-16T04:33:12.118Z","avatar_url":"https://github.com/danielpclark.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# digits\n[![Build Status](https://travis-ci.org/danielpclark/digits.svg?branch=master)](https://travis-ci.org/danielpclark/digits)\n[![crates.io version](https://img.shields.io/crates/v/digits.svg)](https://crates.io/crates/digits)\n[![Documentation](https://img.shields.io/badge/docs-%F0%9F%91%8D-brightgreen.svg)](http://danielpclark.github.io/digits/index.html)\n\nDigits is a custom character base numeric sequencer.  This crate is designed for infinite character progressions.  It will contain additive methods such as `add` and `mul`.\n\nThis is an extension on top of [base_custom](https://github.com/danielpclark/base_custom).\n\nThe largest unsigned digit type in Rust is **u64**.  Consider this an upgrade to **u∞**\nThe limits that this can calculate to are unknown and may only be limited to your systems RAM\nshould you try to reach infinity ;-).\n\nThis package lets you invent your own numeric systems and perform basic math on them including:\n\n* addition\n* multiplication\n* multiply by powers of\n* and simple +1/-1 steps with `succ` and `pred_till_zero`\n* as of version 0.3 Digits preserves zero padding for addition methods\n\nYou may consider this a highly advanced score card flipper (character sequences) with basic\nmath methods added to help progress through sequences as you would like.\n\n### Installation\n\nAdd the following to your Cargo.toml file\n```toml\n[dependencies]\ndigits = \"^1.0\"\n```\n\nTo include it for usage add\n\n```rust\nextern crate digits;\nuse digits::prelude::*;\n```\n\nto your file.\n\n### Usage\n\nThere are several ways to create a new instance of **Digits**, but before any of that you need\nto define you own numeric base from the `base_custom` package.\n\n```rust\n// Define your own numeric base to use using a set of any characters\n// We'll use the string representations for base 10 so you can see this\n// work with something familiar.\n\nlet base10 = BaseCustom::\u003cchar\u003e::new(\"0123456789\".chars().collect());\n\n// Once you have a custom numeric base defined you can create instances of Digits in many ways.\n\nlet hundred = Digits::new(base10.clone(), \"100\".to_string());\n\n// If you don't want to have to pass the base value in each time you create a new number\n// you can propagate a new one out with the `propagate` method.\n\nlet two = hundred.propagate(\"2\".to_string()); // re-uses internal base10 mappings\n\n// Now we have two instances of Digits created: one for 100 and one for 2\n\n// The mathematical methods mutate the Digits instance they're called from\n// so you need to either use `let mut` or call `clone` to use them.\n\nhundred.clone().add(two).to_s() // outputs: \"102\"\nhundred.clone().mul(two).to_s() // outputs: \"200\"\nhundred.clone().pow(two).to_s() // outputs: \"10000\"\n\n// There are several ways to create and check one or zero.\n\nlet one = Digits::new_one(\u0026base10); // A Digits instance with the value of 1\none.is_one() // true\none.is_zero() // false\n\nlet zero = Digits::new_zero(\u0026base10); // A Digits instance with the value of 0\nzero.is_one() // false\nzero.is_zero() // true\n\n// And you can create a one or zero off of an existing Digits instance with `one` or `zero`\nhundred.one() // A Digits instance with the value of 1\nhundred.zero() // A Digits instance with the value of 0\n\n// Count down or up with `pred_till_zero` and `succ`\nlet mut ten = Digits::new(base10.clone(), \"10\".to_string());\nassert_eq!(ten.pred_till_zero().to_s(), \"09\");\nassert_eq!(ten.pred_till_zero().to_s(), \"08\");\nassert_eq!(ten.pred_till_zero().to_s(), \"07\");\n\nlet mut nine = Digits::new(base10.clone(), \"9\".to_string());\nassert_eq!(nine.succ().to_s(), \"10\");\nassert_eq!(nine.succ().to_s(), \"11\");\nassert_eq!(nine.succ().to_s(), \"12\");\n```\n\nAnd this is just with normal 0 thourgh 9 values.  Imagine if you invent your own\nnumeric bases and character sets.  It can be used for quite a lot!\n\n## Goals / Roadmap\n\n1) The first goal of this library is to be thread safe and function well for sequencing characters.\n\n2) The secondary goal, which may improve with time, is performance.\n\n3) The third goal is to have fun re-inventing mathematics and experiments.\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any\nadditional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielpclark%2Fdigits","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielpclark%2Fdigits","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielpclark%2Fdigits/lists"}