Skip to content

Add a multiple choice match list macro. - #1541

Open
drgrice1 wants to merge 1 commit into
openwebwork:developfrom
drgrice1:match-list-macro
Open

drgrice1 wants to merge 1 commit into
openwebwork:developfrom
drgrice1:match-list-macro

Conversation

@drgrice1

Copy link
Copy Markdown
Member

The parserMatchList.pl macro is intended to replace the PGchoicemacros.pl match list (obtained via new_match_list). This is the only thing left from the PGchoicemacros.pl that has not yet been replaced with a modern MathObject equivalent.

The MatchList object derives from a Value::List and is an ans_array type answer. So it is inserted into PGML with the [_]*{...} syntax, and if a custom checker is desired the list_checker is needed.

This macro is similar in nature to the parserPopUp.pl and parserCheckboxList.pl macros in many ways, and actually uses the parserPopUp.pl DropDown object internally. As with the objects from those macros, this MatchList object can be used as a part answer in a MultiAnswer or RadioMultiAnswer.

The tutorial/sample-problems/Misc/Matching.pg has been replaced with the tutorial/sample-problems/Misc/MatchList.pg problem. The tutorial/sample-problems/Misc/MatchingAlt.pg has also been removed, since that approach is better accomplished with the parserMatchList.pl macro.

There are unit tests for the macro in t/macros/parserMatchList.t.

Note that the PTX output will need verification (and probably modification). Claude added something for that, but I don't know what it is correct.

Here are some problems that demonstrate some other uses of the macro that are different than the sample problem:
MatchList.zip

@drgrice1

Copy link
Copy Markdown
Member Author

The attached example problems include problems that use a MatchList in a MultiAnswer and RadioMultiAnswer, and the examples have custom checkers. I wanted to point out that the default MultiAnswer and RadioMultiAnswer checkers do work. The examples just demonstrate how you would do things in a custom checker.

The `parserMatchList.pl` macro is intended to replace the
`PGchoicemacros.pl` match list (obtained via `new_match_list`).
This is the only thing left from the PGchoicemacros.pl that has not yet
been replaced with a modern MathObject equivalent.

The `MatchList` object derives from a `Value::List` and is an
`ans_array` type answer.  So it is inserted into PGML with the
`[_]*{...}` syntax, and if a custom checker is desired the
`list_checker` is needed.

This macro is similar in nature to the `parserPopUp.pl` and
`parserCheckboxList.pl` macros in many ways, and actually uses the
`parserPopUp.pl` `DropDown` object internally. As with the objects from
those macros, this `MatchList` object can be used as a part answer in a
`MultiAnswer` or `RadioMultiAnswer`.

The `tutorial/sample-problems/Misc/Matching.pg` has been replaced with
the `tutorial/sample-problems/Misc/MatchList.pg` problem.  The
`tutorial/sample-problems/Misc/MatchingAlt.pg` has also been removed,
since that approach is better accomplished with the `parserMatchList.pl`
macro.

There are unit tests for the macro in `t/macros/parserMatchList.t`.

Note that the `PTX` output will need verification (and probably
modification).  Claude added something for that, but I don't know what
it is correct.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant