Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain mode #200

Closed
alexec opened this issue Aug 16, 2021 · 10 comments
Closed

Explain mode #200

alexec opened this issue Aug 16, 2021 · 10 comments
Labels

Comments

@alexec
Copy link
Contributor

alexec commented Aug 16, 2021

I'd like to explain to users how a result was calculated:

Say we have this expression, this is what it would print out:

  • c + p / e + P / (n * e)
  • 2 + 100 / 250 + 2500 / (10 * 250)
  • 2 + 0 + 1
  • 3
@antonmedv
Copy link
Member

Nice idea, but currently I don’t a free time to wolf on it. Somebody else?

@alexec
Copy link
Contributor Author

alexec commented Aug 16, 2021

"wolf"? 🐺

@antonmedv
Copy link
Member

Now working on profiler for Expr. Maybe it also can be used here.

@gbgil
Copy link

gbgil commented Jan 8, 2023

I'd also really like to see this feature. I'm willing to help/try doing it myself, but I don't even know where to start. Care to give me some ideas to put me on the right path?

@antonmedv
Copy link
Member

Start with opcode)

@antonmedv
Copy link
Member

antonmedv commented Jan 17, 2024

I have some progress on the feature:

-((2 - 5) ** 3) - 2 / (+4 - 3) + -2
-(-3 ** 3) - 2 / 1 + -2
--27 - 2 + -2
25 + -2
23
reduce(filter(map(map(6..9, # - 2), # * 2), # > 6), #acc + #, -2)
reduce(filter(map(map([6,7,8,9], # - 2), # * 2), # > 6), #acc + #, -2)
reduce(filter(map([4,5,6,7], # * 2), # > 6), #acc + #, -2)
reduce(filter([8,10,12,14], # > 6), #acc + #, -2)
reduce([8,10,12,14], #acc + #, -2)
42
foo < 0 or (bar > 10 and baz == 5) or (qux <= 1 and quux >= 10 and corge > 0.5)
1 < 0 or (99 > 10 and 50 == 5) or (25 <= 1 and 10 >= 10 and 5 > 0.5)
false or (true and false) or (false and true and true)
false or false or (false and true)
false or false
false
garply.a + fn(grault[0] + 1)
1 + fn(1 + 1)
1 + fn(2)
1 + 2
3

@PranavPeshwe
Copy link
Contributor

This sounds useful, @antonmedv 👍🏻

@PranavPeshwe
Copy link
Contributor

PranavPeshwe commented Jan 18, 2024

How does one get/see the output you've shared?

@antonmedv
Copy link
Member

I’m working on this picture as part of Expr Pro package 📦

I will share results little bit later. It’s going to be an addition to Expr.

@antonmedv
Copy link
Member

Explain mode is done!

Now it comes in Expr Pro extension: https://expr-lang.org/expr-pro

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants