# pyclacker
Command line reverse polish notation (RPN) calculator. Stack based and ready to party.
Josh Tompkin
<jtompkin-dev@pm.me>
https://github.com/jtompkin/pyclacker
## Installation
Install with pip
```
pip3 install pyclacker
```
## Usage
```bash
pyclacker [-h] [-v] [-w WORDS_FILE] [program]
```
If provided, `program` should be a single string with commands separated by a space. Running without providing a program will enter interactive mode. In interactive mode, type a number and press enter to push to the stack. Enter an operator and press enter to perform the operation on the stack. Enter multiple commands separated by a space and press enter to execute them in order. Enter `help` to view available operators.
### Words
Custom commands (called words) can be defined in interactive mode or in a file. To define words in a file, provide one word definition on each line. A word definition consists of the word itself and its definition, all separated by spaces. Provide the path to this file when calling the program with `-w`. A file containing the following two lines would define two words: `sqrt`, which pushes 0.5 to the stack and then calls the exponent operator, and `pi`, which pushes the value of pi to the stack
```
sqrt 0.5 ^
pi 3.14159265358979323846
```
To define words in interactive mode, start your command with `=`, followed by a space, followed by the word itself, followed by the word definition, again all separated by spaces. The following commands would accomplish the same word definitions as the file above. (The `>` is not typed)
```
> = sqrt 0.5 ^
> = pi 3.14159265358979323846
```
You can undefine a word by providing its name without any definition. All currently defined words can be viewed by entering `words` at the interactive prompt.
```
> = sqrt
```
Raw data
{
"_id": null,
"home_page": "https://github.com/jtompkin/pyclacker",
"name": "pyclacker",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "calculator, calc, reverse, polish, rpn",
"author": "Josh Tompkin",
"author_email": "jtompkin-dev@pm.me",
"download_url": "https://files.pythonhosted.org/packages/91/68/2401260868f4b97450ec608bd5603062f2fc680fc2874d0cf41a426ef560/pyclacker-1.1.0.tar.gz",
"platform": null,
"description": "# pyclacker\n\nCommand line reverse polish notation (RPN) calculator. Stack based and ready to party.\n\nJosh Tompkin\n\n<jtompkin-dev@pm.me>\n\nhttps://github.com/jtompkin/pyclacker\n\n## Installation\n\nInstall with pip\n```\npip3 install pyclacker\n```\n\n## Usage\n\n```bash\npyclacker [-h] [-v] [-w WORDS_FILE] [program]\n```\nIf provided, `program` should be a single string with commands separated by a space. Running without providing a program will enter interactive mode. In interactive mode, type a number and press enter to push to the stack. Enter an operator and press enter to perform the operation on the stack. Enter multiple commands separated by a space and press enter to execute them in order. Enter `help` to view available operators.\n\n### Words\n\nCustom commands (called words) can be defined in interactive mode or in a file. To define words in a file, provide one word definition on each line. A word definition consists of the word itself and its definition, all separated by spaces. Provide the path to this file when calling the program with `-w`. A file containing the following two lines would define two words: `sqrt`, which pushes 0.5 to the stack and then calls the exponent operator, and `pi`, which pushes the value of pi to the stack\n\n```\nsqrt 0.5 ^\npi 3.14159265358979323846\n```\n\nTo define words in interactive mode, start your command with `=`, followed by a space, followed by the word itself, followed by the word definition, again all separated by spaces. The following commands would accomplish the same word definitions as the file above. (The `>` is not typed)\n\n```\n > = sqrt 0.5 ^\n > = pi 3.14159265358979323846\n```\n\nYou can undefine a word by providing its name without any definition. All currently defined words can be viewed by entering `words` at the interactive prompt.\n\n```\n > = sqrt\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Command line reverse polish notation (RPN) calculator.",
"version": "1.1.0",
"project_urls": {
"Homepage": "https://github.com/jtompkin/pyclacker"
},
"split_keywords": [
"calculator",
" calc",
" reverse",
" polish",
" rpn"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e6ec5292774dcb57abb070aa535af713280fbca4e81f88c65106b55df9722e87",
"md5": "d51f5686c47d63ab03c388a554529384",
"sha256": "c21e413b4bf31bdce3e7ba04345e16d63a3dfe1ebce2ffea8d3289a7659ec898"
},
"downloads": -1,
"filename": "pyclacker-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d51f5686c47d63ab03c388a554529384",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 7042,
"upload_time": "2024-03-24T01:59:54",
"upload_time_iso_8601": "2024-03-24T01:59:54.410705Z",
"url": "https://files.pythonhosted.org/packages/e6/ec/5292774dcb57abb070aa535af713280fbca4e81f88c65106b55df9722e87/pyclacker-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "91682401260868f4b97450ec608bd5603062f2fc680fc2874d0cf41a426ef560",
"md5": "cf608c73e0d2161f6967a5c27a63b962",
"sha256": "90c5f2d9c9eecc5e1a8e0c49723b9c2042dc7fc25401e1e9ba50736200dc724f"
},
"downloads": -1,
"filename": "pyclacker-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "cf608c73e0d2161f6967a5c27a63b962",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 6131,
"upload_time": "2024-03-24T01:59:55",
"upload_time_iso_8601": "2024-03-24T01:59:55.930090Z",
"url": "https://files.pythonhosted.org/packages/91/68/2401260868f4b97450ec608bd5603062f2fc680fc2874d0cf41a426ef560/pyclacker-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-24 01:59:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jtompkin",
"github_project": "pyclacker",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyclacker"
}