Name | kalk JSON |
Version |
0.17.0
JSON |
| download |
home_page | None |
Summary | a simple cli RPN calculator written in Python |
upload_time | 2024-03-23 06:11:31 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | None |
keywords |
calculator
kalkulator
cli
rpn
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
Kalk
====
installation
------------
Requires the latest stable Python_ version.
``pip install kalk``
Usage
-----
After installation run ``kalk`` from your terminal.
In RPN_ syntax one would first enter the operands and then the operator:
.. code-block:: python
>>> 1
1
>>> 2
2
>>> +
3
You may also enter the operands and the operator in one line, just use space to
separate them:
.. code-block:: python
>>> 41 1 +
42
(tip: the space is not needed when the syntax is not ambiguous.)
Kalk tries to follow Python's syntax. Similar to Python, ``**`` is the `power operator`_ and ``^`` is `bitwise XOR`_:
.. code-block:: python
>>> 3 3 **
27
>>> 3 3 ^
0
Kalk ignores ``,`` (thousands separator) within numbers.
.. code-block:: python
>>> 1,234 1 +
1,235
Most of the functions defined in Python's math_ and statistics_ modules are supported.
.. code-block:: python
>>> 6 lgamma
4.787491742782047
and many more.
You can even do ``datetime`` and ``timedelta`` calculations:
.. code-block:: python
>>> "2023-03-22" dt
2023-03-22 00:00:00
>>> 2 days 3 hours +
2 days, 3:00:00
>>> -
2023-03-19 21:00:00
Start a substack (a list) with a ``[`` and end it with a ``]``. Some functions require lists as argument. For example to calculate the distance between two points or sum of some numbers:
.. code-block:: python
>>> [2 -1] [-2 2] dist
5.0
>>> [0 0 0] [1 1 1] dist
1.7320508075688772
>>> [1 1 1] sum
3
Handy operators:
* ``<>`` swaps the place of the last two values in the stack.
* ``c`` clears the stack
* ``cp`` copies the last result to clipboard.
* ``del`` deletes the last ``n + 1`` values from from the stack with ``n`` being the last value in the stack.
* ``e`` adds `Euler's number` to the stack
* ``pi`` adds the pi constant to the stack
* ``pst`` pastes the contents of clipboard and evaluates it.
* ``a`` the last answer
* ``s`` prints the stack
* ``sto`` stores the value before the last in storage using the last stack value as the key.
* ``rcl`` recalls the value in storage using the last stack value as the key.
* ``h`` prints a list of all operators. (still needs lots of refinements.)
* ``?`` prints the docstring of the operator given as a string. For example ``"<>" ?`` will print the help string on swap. Note that not all functions have documentation yet.
* ``ctrl+c`` (KeyboardInterrupt) will cancel the current input.
* ``exit`` will quit the program.
.. _RPN: https://en.wikipedia.org/wiki/Reverse_Polish_notation
.. _power operator: https://docs.python.org/3/reference/expressions.html#the-power-operator
.. _bitwise XOR: https://docs.python.org/3/reference/expressions.html#binary-bitwise-operations
.. _math: https://docs.python.org/3/library/math.html
.. _statistics: https://docs.python.org/3/library/statistics.html
.. _operator: https://docs.python.org/3/library/operator.html
.. _Euler's number: https://en.wikipedia.org/wiki/E_(mathematical_constant)
.. _Python: https://www.python.org/downloads/
Raw data
{
"_id": null,
"home_page": null,
"name": "kalk",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "calculator, kalkulator, cli, RPN",
"author": null,
"author_email": "5j9 <5j9@users.noreply.github.com>",
"download_url": "https://files.pythonhosted.org/packages/d7/b8/ac4a9253e9f490144fdd6e39aa5fbc31a2fd8a1b35c38fdc447e40515ac6/kalk-0.17.0.tar.gz",
"platform": null,
"description": "Kalk\n====\n\ninstallation\n------------\nRequires the latest stable Python_ version.\n\n``pip install kalk``\n\nUsage\n-----\nAfter installation run ``kalk`` from your terminal.\n\nIn RPN_ syntax one would first enter the operands and then the operator:\n\n.. code-block:: python\n\n\n >>> 1\n 1\n >>> 2\n 2\n >>> +\n 3\n\n\nYou may also enter the operands and the operator in one line, just use space to\nseparate them:\n\n.. code-block:: python\n\n >>> 41 1 +\n 42\n\n(tip: the space is not needed when the syntax is not ambiguous.)\n\nKalk tries to follow Python's syntax. Similar to Python, ``**`` is the `power operator`_ and ``^`` is `bitwise XOR`_:\n\n.. code-block:: python\n\n >>> 3 3 **\n 27\n >>> 3 3 ^\n 0\n\nKalk ignores ``,`` (thousands separator) within numbers.\n\n.. code-block:: python\n\n >>> 1,234 1 +\n 1,235\n\nMost of the functions defined in Python's math_ and statistics_ modules are supported.\n\n.. code-block:: python\n\n >>> 6 lgamma\n 4.787491742782047\n\nand many more.\n\n\nYou can even do ``datetime`` and ``timedelta`` calculations:\n\n.. code-block:: python\n\n >>> \"2023-03-22\" dt\n 2023-03-22 00:00:00\n >>> 2 days 3 hours +\n 2 days, 3:00:00\n >>> -\n 2023-03-19 21:00:00\n\nStart a substack (a list) with a ``[`` and end it with a ``]``. Some functions require lists as argument. For example to calculate the distance between two points or sum of some numbers:\n\n.. code-block:: python\n\n >>> [2 -1] [-2 2] dist\n 5.0\n >>> [0 0 0] [1 1 1] dist\n 1.7320508075688772\n >>> [1 1 1] sum\n 3\n\n\nHandy operators:\n\n* ``<>`` swaps the place of the last two values in the stack.\n* ``c`` clears the stack\n* ``cp`` copies the last result to clipboard.\n* ``del`` deletes the last ``n + 1`` values from from the stack with ``n`` being the last value in the stack.\n* ``e`` adds `Euler's number` to the stack\n* ``pi`` adds the pi constant to the stack\n* ``pst`` pastes the contents of clipboard and evaluates it.\n* ``a`` the last answer\n* ``s`` prints the stack\n* ``sto`` stores the value before the last in storage using the last stack value as the key.\n* ``rcl`` recalls the value in storage using the last stack value as the key.\n* ``h`` prints a list of all operators. (still needs lots of refinements.)\n* ``?`` prints the docstring of the operator given as a string. For example ``\"<>\" ?`` will print the help string on swap. Note that not all functions have documentation yet.\n* ``ctrl+c`` (KeyboardInterrupt) will cancel the current input.\n* ``exit`` will quit the program.\n\n\n.. _RPN: https://en.wikipedia.org/wiki/Reverse_Polish_notation\n.. _power operator: https://docs.python.org/3/reference/expressions.html#the-power-operator\n.. _bitwise XOR: https://docs.python.org/3/reference/expressions.html#binary-bitwise-operations\n.. _math: https://docs.python.org/3/library/math.html\n.. _statistics: https://docs.python.org/3/library/statistics.html\n.. _operator: https://docs.python.org/3/library/operator.html\n.. _Euler's number: https://en.wikipedia.org/wiki/E_(mathematical_constant)\n.. _Python: https://www.python.org/downloads/\n",
"bugtrack_url": null,
"license": null,
"summary": "a simple cli RPN calculator written in Python",
"version": "0.17.0",
"project_urls": {
"Homepage": "https://github.com/5j9/kalk"
},
"split_keywords": [
"calculator",
" kalkulator",
" cli",
" rpn"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "ae4b49c20f00e222cbeb6497e7061f7e2415ab65f8baa1df9613b449ad7f0268",
"md5": "94d9c50d4effd3145b9fe56bc52ac7e5",
"sha256": "25aad507455ba45d2f35702087d67be6483db6a548fb3319c2b83907a37ef527"
},
"downloads": -1,
"filename": "kalk-0.17.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "94d9c50d4effd3145b9fe56bc52ac7e5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 19208,
"upload_time": "2024-03-23T06:11:28",
"upload_time_iso_8601": "2024-03-23T06:11:28.431193Z",
"url": "https://files.pythonhosted.org/packages/ae/4b/49c20f00e222cbeb6497e7061f7e2415ab65f8baa1df9613b449ad7f0268/kalk-0.17.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d7b8ac4a9253e9f490144fdd6e39aa5fbc31a2fd8a1b35c38fdc447e40515ac6",
"md5": "2f9a762d03a33ee5befc2cae4d4823f6",
"sha256": "ae5769b83fb83b5f38b0fe1eb9c5948287f7fbe4e7eab8524e4fa2e8e673427c"
},
"downloads": -1,
"filename": "kalk-0.17.0.tar.gz",
"has_sig": false,
"md5_digest": "2f9a762d03a33ee5befc2cae4d4823f6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 19691,
"upload_time": "2024-03-23T06:11:31",
"upload_time_iso_8601": "2024-03-23T06:11:31.233019Z",
"url": "https://files.pythonhosted.org/packages/d7/b8/ac4a9253e9f490144fdd6e39aa5fbc31a2fd8a1b35c38fdc447e40515ac6/kalk-0.17.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-23 06:11:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "5j9",
"github_project": "kalk",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "kalk"
}