Live data from Hacker News

Hyoka

github.com

11–20 of 20 posts

Re: Hyoka

#13

I created a lightweight and precise math expression parser and evaluator for JavaScript and TypeScript. it can handle complex arithmetic expressions

Damn that's pretty sweet, I've had to pretty much just make anything that needs extreme decimal precision work out on server side. Cool to know someone came up with a way to do it on frontend too, thanks!

Re: Hyoka

#14

Earlier quoted context omitted.

I would show examples in README on use of it along with string interpolation, as it's not too useful with only constants. Eg. const a = 3; const b = 2; const expression = new Expression(`${a}*${b}(6/3(5--2))`); const result = expression.evaluate(); document.getElementById("app").innerHTML = `a*b( 6 / 3( 5 - - 2 ) )= ${result}`; Edit: formating

Nice tip, i'm planning to add an identifier node class so that you can pass a scope with the values to be used during evaluation. Eg. const a = 2; const b = 6; const c = 3 const expression = new Expression('a \ b * c') const result = expression.scope({a, b, c}).evaluate(); document.getElementById("app").innerHTML `${a} \ ${b} * ${c}= ${result}`

Very welcome solution. String interpolation makes it possible, but it's bad DX.

Re: Hyoka

#15

Does the name have any special meaning?

It means “evaluate”, but in the sense of evaluating a piece of artwork, so my guess is that the author justed ran the word through Google Translate.

Re: Hyoka

#16

I created a lightweight and precise math expression parser and evaluator for JavaScript and TypeScript. it can handle complex arithmetic expressions

Damn that's pretty sweet, I've had to pretty much just make anything that needs extreme decimal precision work out on server side. Cool to know someone came up with a way to do it on frontend too, thanks!

I'm glad you find it useful. thanks for the feedback

Re: Hyoka

#17

Earlier quoted context omitted.

Nice tip, i'm planning to add an identifier node class so that you can pass a scope with the values to be used during evaluation. Eg. const a = 2; const b = 6; const c = 3 const expression = new Expression('a \ b * c') const result = expression.scope({a, b, c}).evaluate(); document.getElementById("app").innerHTML `${a} \ ${b} * ${c}= ${result}`

Very welcome solution. String interpolation makes it possible, but it's bad DX.

yeah having to type ${} everywhere makes the code a little bit messy.

Re: Hyoka

#18
post #15

Does the name have any special meaning?

It means “evaluate”, but in the sense of evaluating a piece of artwork, so my guess is that the author justed ran the word through Google Translate.

According to this[1] okwave thread (in Japanese) it is used in mathematics literature but generally as a direct translation from English. There is an argument there, saying that the nuance of Hyouka in Japanese mathematics is more appropriate in cases where a specific value is harder to determine and as such is used more often for things like "inequality evaluation".

[1]: https://okwave.jp/qa/q5812331.html

Post reply on HN