https://github.com/zachgrayio/kalk
A CLI calculator written in Kotlin.
https://github.com/zachgrayio/kalk
Last synced: 12 months ago
JSON representation
A CLI calculator written in Kotlin.
- Host: GitHub
- URL: https://github.com/zachgrayio/kalk
- Owner: zachgrayio
- License: other
- Created: 2017-09-07T09:15:59.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-04T12:52:09.000Z (over 8 years ago)
- Last Synced: 2025-06-01T12:09:33.237Z (about 1 year ago)
- Language: Kotlin
- Size: 89.8 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# kalk
A CLI calculator written in Kotlin.
### Notable features
- This program implements the [shunting-yard](https://en.wikipedia.org/wiki/Shunting-yard_algorithm) in Kotlin as an extension method on `String` - see [String.toRPNExpression()](https://github.com/zachgrayio/kalk/blob/master/src/main/kotlin/io/zachgray/kalk/math/ext/String.kt).
- Also implemented is an [RPN expression evaluator](https://github.com/zachgrayio/kalk/blob/master/src/main/kotlin/io/zachgray/kalk/math/RPNExpression.kt) which is fairly succinct thanks to the use of the `Operator` sealed class which can be found [here](https://github.com/zachgrayio/kalk/blob/master/src/main/kotlin/io/zachgray/kalk/math/Operator.kt).
### Usage
- `$ kalk` for interactive mode
- `$ kalk 2 + 2` to verify two plus two is in fact four!
### Installation
- Install with NPM: `$ npm i -g kalk`
### Build & run from source
- `$ git clone git@github.com:zachgrayio/kalk.git`
- `$ cd kalk`
- `$ ./gradlew assembleDist`
- `$ unzip build/distributions/kalk-1.1.0.zip`
- inline: `$ kalk-1.1.0/bin/kalk 2 + 2`
- interactive: `$ kalk-1.1.0/bin/kalk`