{"id":16474833,"url":"https://github.com/zegl/rules_calculator","last_synced_at":"2025-10-23T17:20:43.672Z","repository":{"id":81755150,"uuid":"204444883","full_name":"zegl/rules_calculator","owner":"zegl","description":"A calculator in Bazel - Created for a talk at `bazel build //stockholm/...`","archived":false,"fork":false,"pushed_at":"2019-08-27T13:19:04.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-11T04:17:28.370Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zegl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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},"funding":{"polar":"zegl"}},"created_at":"2019-08-26T09:44:14.000Z","updated_at":"2019-08-27T13:19:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"2fccae69-aac2-469e-a93d-8094ecda7fcc","html_url":"https://github.com/zegl/rules_calculator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zegl%2Frules_calculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zegl%2Frules_calculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zegl%2Frules_calculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zegl%2Frules_calculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zegl","download_url":"https://codeload.github.com/zegl/rules_calculator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241131352,"owners_count":19914898,"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-10-11T12:34:33.222Z","updated_at":"2025-10-23T17:20:38.633Z","avatar_url":"https://github.com/zegl.png","language":"Python","funding_links":["https://polar.sh/zegl"],"categories":[],"sub_categories":[],"readme":"# rules_calculator\n\nA toy project for learning about Bazel rules, and will be used as the base for a talk at the [bazel build //stockholm/...](https://www.meetup.com/BazelSTHLM) meetup group.\n\n## Documentation\n\n\u003c!-- Generated with Stardoc: http://skydoc.bazel.build --\u003e\n\n\u003ca name=\"#add\"\u003e\u003c/a\u003e\n\n## add\n\n\u003cpre\u003e\nadd(\u003ca href=\"#add-name\"\u003ename\u003c/a\u003e, \u003ca href=\"#add-terms\"\u003eterms\u003c/a\u003e)\n\u003c/pre\u003e\n\n\nCalculates the sum (addition) of the provided numbers.\n\nExample:\n\n```python\n# Calculates 3 + 4 + 2, with the output 9\nadd(\n    name = \"three_plus_four_plus_two\",\n    terms = [\n        \":three\",\n        \":four\",\n        \":two\",\n    ],\n)\n```\n\n\n### Attributes\n\n\u003ctable class=\"params-table\"\u003e\n  \u003ccolgroup\u003e\n    \u003ccol class=\"col-param\" /\u003e\n    \u003ccol class=\"col-description\" /\u003e\n  \u003c/colgroup\u003e\n  \u003ctbody\u003e\n    \u003ctr id=\"add-name\"\u003e\n      \u003ctd\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://bazel.build/docs/build-ref.html#name\"\u003eName\u003c/a\u003e; required\n        \u003cp\u003e\n          A unique name for this target.\n        \u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr id=\"add-terms\"\u003e\n      \u003ctd\u003e\u003ccode\u003eterms\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://bazel.build/docs/build-ref.html#labels\"\u003eList of labels\u003c/a\u003e; required\n        \u003cp\u003e\n          The numbers to add\n        \u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\n\u003c!-- Generated with Stardoc: http://skydoc.bazel.build --\u003e\n\n\u003ca name=\"#display\"\u003e\u003c/a\u003e\n\n## display\n\n\u003cpre\u003e\ndisplay(\u003ca href=\"#display-name\"\u003ename\u003c/a\u003e, \u003ca href=\"#display-value\"\u003evalue\u003c/a\u003e)\n\u003c/pre\u003e\n\n\n\n### Attributes\n\n\u003ctable class=\"params-table\"\u003e\n  \u003ccolgroup\u003e\n    \u003ccol class=\"col-param\" /\u003e\n    \u003ccol class=\"col-description\" /\u003e\n  \u003c/colgroup\u003e\n  \u003ctbody\u003e\n    \u003ctr id=\"display-name\"\u003e\n      \u003ctd\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://bazel.build/docs/build-ref.html#name\"\u003eName\u003c/a\u003e; required\n        \u003cp\u003e\n          A unique name for this target.\n        \u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr id=\"display-value\"\u003e\n      \u003ctd\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://bazel.build/docs/build-ref.html#labels\"\u003eLabel\u003c/a\u003e; required\n        \u003cp\u003e\n          The numbers to print when running this target\n        \u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\n\u003c!-- Generated with Stardoc: http://skydoc.bazel.build --\u003e\n\n\u003ca name=\"#div\"\u003e\u003c/a\u003e\n\n## div\n\n\u003cpre\u003e\ndiv(\u003ca href=\"#div-name\"\u003ename\u003c/a\u003e, \u003ca href=\"#div-dividend\"\u003edividend\u003c/a\u003e, \u003ca href=\"#div-divisor\"\u003edivisor\u003c/a\u003e)\n\u003c/pre\u003e\n\n\nDivides the `dividend` with the `divisor`, and outputs the `qoutient`.\n\nExample:\n\n```python\n# Calculates 20 / 5 to return 4\nadd(\n    name = \"tewnty_div_five\",\n    dividend = \":twenty\",\n    divisor = \":four\",\n)\n```\n\n\n### Attributes\n\n\u003ctable class=\"params-table\"\u003e\n  \u003ccolgroup\u003e\n    \u003ccol class=\"col-param\" /\u003e\n    \u003ccol class=\"col-description\" /\u003e\n  \u003c/colgroup\u003e\n  \u003ctbody\u003e\n    \u003ctr id=\"div-name\"\u003e\n      \u003ctd\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://bazel.build/docs/build-ref.html#name\"\u003eName\u003c/a\u003e; required\n        \u003cp\u003e\n          A unique name for this target.\n        \u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr id=\"div-dividend\"\u003e\n      \u003ctd\u003e\u003ccode\u003edividend\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://bazel.build/docs/build-ref.html#labels\"\u003eLabel\u003c/a\u003e; required\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr id=\"div-divisor\"\u003e\n      \u003ctd\u003e\u003ccode\u003edivisor\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://bazel.build/docs/build-ref.html#labels\"\u003eLabel\u003c/a\u003e; required\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\n\u003c!-- Generated with Stardoc: http://skydoc.bazel.build --\u003e\n\n\u003ca name=\"#fib\"\u003e\u003c/a\u003e\n\n## fib\n\n\u003cpre\u003e\nfib(\u003ca href=\"#fib-name\"\u003ename\u003c/a\u003e, \u003ca href=\"#fib-n\"\u003en\u003c/a\u003e)\n\u003c/pre\u003e\n\n\n\n### Parameters\n\n\u003ctable class=\"params-table\"\u003e\n  \u003ccolgroup\u003e\n    \u003ccol class=\"col-param\" /\u003e\n    \u003ccol class=\"col-description\" /\u003e\n  \u003c/colgroup\u003e\n  \u003ctbody\u003e\n    \u003ctr id=\"fib-name\"\u003e\n      \u003ctd\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        required.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr id=\"fib-n\"\u003e\n      \u003ctd\u003e\u003ccode\u003en\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        required.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\n\u003c!-- Generated with Stardoc: http://skydoc.bazel.build --\u003e\n\n\u003ca name=\"#mul\"\u003e\u003c/a\u003e\n\n## mul\n\n\u003cpre\u003e\nmul(\u003ca href=\"#mul-name\"\u003ename\u003c/a\u003e, \u003ca href=\"#mul-terms\"\u003eterms\u003c/a\u003e)\n\u003c/pre\u003e\n\n\nCalculates the product of the factors.\n\nExample:\n\n```python\n# Calculates 3 * 4 * 2, with the output 24\nmul(\n    name = \"three_plus_four_plus_two\",\n    terms = [\n        \":three\",\n        \":four\",\n        \":two\",\n    ],\n)\n```\n\n\n### Attributes\n\n\u003ctable class=\"params-table\"\u003e\n  \u003ccolgroup\u003e\n    \u003ccol class=\"col-param\" /\u003e\n    \u003ccol class=\"col-description\" /\u003e\n  \u003c/colgroup\u003e\n  \u003ctbody\u003e\n    \u003ctr id=\"mul-name\"\u003e\n      \u003ctd\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://bazel.build/docs/build-ref.html#name\"\u003eName\u003c/a\u003e; required\n        \u003cp\u003e\n          A unique name for this target.\n        \u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr id=\"mul-terms\"\u003e\n      \u003ctd\u003e\u003ccode\u003eterms\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://bazel.build/docs/build-ref.html#labels\"\u003eList of labels\u003c/a\u003e; required\n        \u003cp\u003e\n          The factors to multiply with each other\n        \u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\n\u003c!-- Generated with Stardoc: http://skydoc.bazel.build --\u003e\n\n\u003ca name=\"#number\"\u003e\u003c/a\u003e\n\n## number\n\n\u003cpre\u003e\nnumber(\u003ca href=\"#number-name\"\u003ename\u003c/a\u003e, \u003ca href=\"#number-number\"\u003enumber\u003c/a\u003e)\n\u003c/pre\u003e\n\n\nDefines a single static number.\n\nExample:\n\n```python\nnumber(\n    name = \"five\",\n    number = 5,\n)\n```\n\n\n### Attributes\n\n\u003ctable class=\"params-table\"\u003e\n  \u003ccolgroup\u003e\n    \u003ccol class=\"col-param\" /\u003e\n    \u003ccol class=\"col-description\" /\u003e\n  \u003c/colgroup\u003e\n  \u003ctbody\u003e\n    \u003ctr id=\"number-name\"\u003e\n      \u003ctd\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://bazel.build/docs/build-ref.html#name\"\u003eName\u003c/a\u003e; required\n        \u003cp\u003e\n          A unique name for this target.\n        \u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr id=\"number-number\"\u003e\n      \u003ctd\u003e\u003ccode\u003enumber\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        Integer; required\n        \u003cp\u003e\n          The integer to write to the output\n        \u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\n\u003c!-- Generated with Stardoc: http://skydoc.bazel.build --\u003e\n\n\u003ca name=\"#sub\"\u003e\u003c/a\u003e\n\n## sub\n\n\u003cpre\u003e\nsub(\u003ca href=\"#sub-name\"\u003ename\u003c/a\u003e, \u003ca href=\"#sub-subtract\"\u003esubtract\u003c/a\u003e, \u003ca href=\"#sub-value\"\u003evalue\u003c/a\u003e)\n\u003c/pre\u003e\n\n\nCalculates the difference between two terms.\n\nExample:\n\n```python\n# Calculates 20 - 5 to return 15\nsub(\n    name = \"twenty_minus_five\",\n    terms = []\n    value = \":twenty\",\n    subtract = \":five\",\n)\n```\n\n\n### Attributes\n\n\u003ctable class=\"params-table\"\u003e\n  \u003ccolgroup\u003e\n    \u003ccol class=\"col-param\" /\u003e\n    \u003ccol class=\"col-description\" /\u003e\n  \u003c/colgroup\u003e\n  \u003ctbody\u003e\n    \u003ctr id=\"sub-name\"\u003e\n      \u003ctd\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://bazel.build/docs/build-ref.html#name\"\u003eName\u003c/a\u003e; required\n        \u003cp\u003e\n          A unique name for this target.\n        \u003c/p\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr id=\"sub-subtract\"\u003e\n      \u003ctd\u003e\u003ccode\u003esubtract\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://bazel.build/docs/build-ref.html#labels\"\u003eLabel\u003c/a\u003e; required\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr id=\"sub-value\"\u003e\n      \u003ctd\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        \u003ca href=\"https://bazel.build/docs/build-ref.html#labels\"\u003eLabel\u003c/a\u003e; required\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzegl%2Frules_calculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzegl%2Frules_calculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzegl%2Frules_calculator/lists"}