Skip to content

Explain mode #200

Closed
Closed
@alexec

Description

@alexec
Contributor

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

Activity

antonmedv

antonmedv commented on Aug 16, 2021

@antonmedv
Member

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

alexec

alexec commented on Aug 16, 2021

@alexec
ContributorAuthor

"wolf"? 🐺

antonmedv

antonmedv commented on Nov 5, 2022

@antonmedv
Member

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

gbgil

gbgil commented on Jan 8, 2023

@gbgil

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

antonmedv commented on Jan 8, 2023

@antonmedv
Member

Start with opcode)

antonmedv

antonmedv commented on Jan 17, 2024

@antonmedv
Member

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

PranavPeshwe commented on Jan 18, 2024

@PranavPeshwe
Contributor

This sounds useful, @antonmedv 👍🏻

PranavPeshwe

PranavPeshwe commented on Jan 18, 2024

@PranavPeshwe
Contributor

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

antonmedv

antonmedv commented on Jan 18, 2024

@antonmedv
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

antonmedv commented on Jan 23, 2024

@antonmedv
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @antonmedv@PranavPeshwe@alexec@gbgil

        Issue actions

          Explain mode · Issue #200 · expr-lang/expr