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

repeated macro #1000

Merged
merged 1 commit into from
Feb 7, 2024
Merged

repeated macro #1000

merged 1 commit into from
Feb 7, 2024

Conversation

Alex-Jordan
Copy link
Contributor

@Alex-Jordan Alex-Jordan commented Feb 2, 2024

Sometimes I want to check if there are repeats in some list. This macro will make that easy to code in a PG problem.

Use !repeated(@array) to test (boolean true or false) if @array has repeats. If it does and you actually want to see them, repeated(@array) will be the list of repeats. Subject to the special consideration noted in the POD.

Copy link
Member

@pstaabp pstaabp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

Copy link
Member

@drdrew42 drdrew42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@pstaabp pstaabp merged commit f10eac1 into openwebwork:develop Feb 7, 2024
Comment on lines +580 to +581
for my $x (@_) {
push(@return,$x) if (grep { $_ == $x } (@_)) > 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now failing perltidy tests here, there is a misplaced space: push(@return, $x) if (grep { $_ == $x } (@_)) > 1;.

drgrice1 added a commit to drgrice1/pg that referenced this pull request Feb 9, 2024
This will be merged immediately.  We rushed the merge of openwebwork#1000 before
the workflow completed I think.  Thus we didn't see this at that time.
Alex-Jordan pushed a commit to Alex-Jordan/pg that referenced this pull request Feb 13, 2024
This will be merged immediately.  We rushed the merge of openwebwork#1000 before
the workflow completed I think.  Thus we didn't see this at that time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants