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

Feature request: Filtered firstline #1396

Closed
Mat-Ge opened this issue Feb 14, 2025 · 6 comments
Closed

Feature request: Filtered firstline #1396

Mat-Ge opened this issue Feb 14, 2025 · 6 comments

Comments

@Mat-Ge
Copy link
Contributor

Mat-Ge commented Feb 14, 2025

In equivalence reasoning, the option firstline for the syntax hint is quite nice. Unfortunately, the expression is taken unformatted from the modal answer. Would it be trivial or complicated to run this expression through the same filters as the validated expression (especially for the insert stars)?
Example: Here, the expression is barely readable due to the many stars, in contrast to the validated expression.
Image

If the expression was created with simp=false (e.g. so that the expression is arranged as desired), then unnecessary brackets are also visible, which are also filtered out in the validated expression.
Image

@sangwinc
Copy link
Member

I think, @Mat-Ge, you asking us to run the expression through the filter backwards?! That is, rather than insert the *s you want us to delete them? There's no option for that currently, sorry.

@Mat-Ge
Copy link
Contributor Author

Mat-Ge commented Feb 18, 2025

The approach I was hoping for was not well formulated, sorry for that. Since the firstline is an input that should look as similar as possible to the output, I would have imagined the process to go something like this:

  • First, unnecessary brackets and stars (depending on options/multiplication signs) could be removed. This process would basically be the same as when an expression is shown in the validation field (although the expression should not be in TeX, since it should ultimately be used as input).
  • After that, however, multiplication signs might have to be inserted again (depending on the selection for insert stars) to obtain a valid expression.

It may be that implementing this process is disproportionately complicated and a question-based approach using JS is more promising.

@sangwinc
Copy link
Member

One of my personal goals for STACK was to gradually communicate to (my undergraduate) students the importance of using a syntax. In that context, the more a teacher uses a correct syntax, e.g. 2*x, the better. For this reason, I never added the feature to remove those *s or make other modifications.

Actually, STACK does de-parse teacher's input quite a lot. E.g. changing things like stackunits(9.81,m/s^2) into 9.81*m/s^2 when we create the "correct response" in this method: https://github.com/maths/moodle-qtype_stack/blob/dev/stack/input/inputbase.class.php#L1570

So, for example, this is the point where a . as a decimal separator is replaced by a comma when the decimals option is set for a comma.
https://github.com/maths/moodle-qtype_stack/blob/dev/stack/input/inputbase.class.php#L1593

Basically, we'd have to provide more functionality at this point. It's a lot of work, and given my goals I'm not sure this really is a high priority for me in the short term, sorry!

@sangwinc
Copy link
Member

Would processing the syntax hint as castext solve this issue @Mat-Ge. If so, then this is now a duplicate of #697 (which I've found time to work on this week) so please could you close this and comment there?.

@Mat-Ge
Copy link
Contributor Author

Mat-Ge commented Feb 19, 2025

Many thanks for your work Chris! It seems, you have found a surprising clear and simple approach to solve this issue. It is my pleasure to close this issue.

@Mat-Ge Mat-Ge closed this as completed Feb 19, 2025
@sangwinc
Copy link
Member

Thanks @Mat-Ge if you can send me some real examples (by email is fine) then I'll add them into the unit tests so that I remember these are examples of real behavior we need to preserve.

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

No branches or pull requests

2 participants