Skip to content
Snippets Groups Projects
Commit fc57ba67 authored by smmercuri's avatar smmercuri
Browse files

Update names of set functions and add more for completeness

parent 8ed43a4a
No related branches found
No related tags found
No related merge requests found
...@@ -121,23 +121,40 @@ match_transpose(ans) := block( ...@@ -121,23 +121,40 @@ match_transpose(ans) := block(
/* /*
* Use this on both the model answer and the student input * Use this on both the model answer and the student input
* when you do not care about the order within a column. * when you do not care about the order within a column.
* Combine with `match_transpose` if you do not care about the order
* within a row.
* *
* It will turn `[[a, b], [c, d]]` into `[{a, b}, {c, d}]`. * It will turn `[[a, b], [c, d], [e, f]]` into `[{a, b}, {c, d}, {e, f}]`.
*/ */
match_column_setify(ans) := block( match_column_set(ans) := block(
return(map(lambda([col], apply(set, col)), ans)) return(map(lambda([col], apply(set, col)), ans))
); );
/*
* Use this on both the model answer and the student input
* when you do not care about the order within a row.
*
* It will turn `[[a, b], [c, d], [e, f]]` into `[{a, c, e}, {b, d, f}]`.
*/
match_row_set(ans) := block(
return(match_column_set(match_transpose(ans)))
);
/* /*
* Use this on both the model answer and the student input * Use this on both the model answer and the student input
* when you do not care about the order between columns. * when you do not care about the order between columns.
* Combine with `match_transpose` if you do not care about
* the order between rows.
* *
* It will turn `[[a, b], [c, d]]` into `{[a, b], [c, d]}`. * It will turn `[[a, b], [c, d], [e, f]]` into `{[a, b], [c, d], [e, f]}`.
*/ */
match_setify(ans) := block( match_set_column(ans) := block(
return(apply(set, ans)) return(apply(set, ans))
); );
/*
* Use this on both the model answer and the student input
* when you do not care about the order between rows.
*
* It will turn `[[a, b], [c, d], [e, f]]` into `{[a, c, e], [b, d, f]}`.
*/
match_set_row(ans) := block(
return(match_set_column(match_transpose(ans)))
);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment