Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/2a5f/l-exp
Just a try / It is an extended version of a prefix expression
https://github.com/2a5f/l-exp
l-expression left left-expression left-notation math polish-notation prefix prefix-expression prefix-notation
Last synced: 9 days ago
JSON representation
Just a try / It is an extended version of a prefix expression
- Host: GitHub
- URL: https://github.com/2a5f/l-exp
- Owner: 2A5F
- License: mit
- Created: 2018-03-22T11:57:18.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T14:45:13.000Z (11 months ago)
- Last Synced: 2023-12-15T15:56:46.327Z (11 months ago)
- Topics: l-expression, left, left-expression, left-notation, math, polish-notation, prefix, prefix-expression, prefix-notation
- Language: JavaScript
- Homepage: http://static.abits.io/l-exp/
- Size: 8.79 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### It is an extended version of a Prefix Notation(Polish notation)
### 这是一个前缀表达式(波兰表达式)的扩展## Syntax 语法
> No float support temporarily 暂时不支持浮点数
- Default is Multiplication 默认是乘法
```
1 2 = 1 * 2
```
- Can multiple values 可以一次计算多个值
```
+1 2 3 4 5 = 1 + 2 + 3 + 4 + 5
```
- `,` The Closure 闭合符
```
/-2 1,3 = (2 - 1) / 3
```
- `;` The Back 返回符
Back to two consecutive operators
返回到两个连续的操作符处
```
/-2+5 1;3 = (2 - (5 + 1)) / 3
↑ ↓
←-←-←-←-
```
```
**/3+1*9 0;8,2 = ((3 / (1 + (9 * 0))) * 8) * 2
↑↑ ↓ ↓
↑ ↖←-←-←-↙ ↓
↖-←-←-←-←-←↙
```
[Try Online](http://static.abits.io/l-exp/)
**lexp** ( exp_str : `string` ) => com_res : `number`
Example:
```javascript
lexp('**/3+1*9 0;8,2')
```
I bet someone already thought of this.
我感觉肯定早就有人想出这个了