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": "5j9",
"author_email": "5j9 <5j9@users.noreply.github.com>",
"download_url": "https://files.pythonhosted.org/packages/c3/2d/53197ba4bfff98629205d3866032f77920aaa3933ff458fb59bdffa6947d/kalk-0.19.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": "GNU General Public License v3 (GPLv3)",
"summary": "a simple cli RPN calculator written in Python",
"version": "0.19.0",
"project_urls": {
"Homepage": "https://github.com/5j9/kalk"
},
"split_keywords": [
"calculator",
" kalkulator",
" cli",
" rpn"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "ed88c09c8f0cf3e89ae2ffe8ff952204b7975a51619bfb9eeec7af5cfc4c7130",
"md5": "955943652a33cbc8d23c38bbfa74bafe",
"sha256": "3dd733d4402aa11abfc24ecc7ebbd936f52f06e28952cb2679c3a6a369f1ccd5"
},
"downloads": -1,
"filename": "kalk-0.19.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "955943652a33cbc8d23c38bbfa74bafe",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 7322,
"upload_time": "2025-08-21T06:32:42",
"upload_time_iso_8601": "2025-08-21T06:32:42.654810Z",
"url": "https://files.pythonhosted.org/packages/ed/88/c09c8f0cf3e89ae2ffe8ff952204b7975a51619bfb9eeec7af5cfc4c7130/kalk-0.19.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c32d53197ba4bfff98629205d3866032f77920aaa3933ff458fb59bdffa6947d",
"md5": "b868475831d94a59e077a0a0b5af892e",
"sha256": "97a928b55f1aebb63508047e4b5b99e5f9e87630aba75c774db44d01086b5800"
},
"downloads": -1,
"filename": "kalk-0.19.0.tar.gz",
"has_sig": false,
"md5_digest": "b868475831d94a59e077a0a0b5af892e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 6626,
"upload_time": "2025-08-21T06:32:44",
"upload_time_iso_8601": "2025-08-21T06:32:44.052765Z",
"url": "https://files.pythonhosted.org/packages/c3/2d/53197ba4bfff98629205d3866032f77920aaa3933ff458fb59bdffa6947d/kalk-0.19.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-21 06:32:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "5j9",
"github_project": "kalk",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "kalk"
}