diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-09-27 10:28:14 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-09-27 10:28:14 -0700 |
commit | 048a33c24fe4b1e937391693e3556e1edfdbfbcd (patch) | |
tree | 2bf1f6034171283d1f01123d79a9deeef5949647 | |
parent | a91e183799b5ba41455c79e648ff4397a27838c4 (diff) | |
download | mu-048a33c24fe4b1e937391693e3556e1edfdbfbcd.tar.gz |
3422
Stop checking the number of ingredients and products when picking shape-shifting recipes. That's more consistent with how we handle regular recipes, and we still get errors in all the examples I can think of: reverse # no ingredients or products n:num <- length # no ingredients; products don't provide type
-rw-r--r-- | 056shape_shifting_recipe.cc | 12 | ||||
-rw-r--r-- | 064list.mu | 2 |
2 files changed, 3 insertions, 11 deletions
diff --git a/056shape_shifting_recipe.cc b/056shape_shifting_recipe.cc index 49b6fcdf..a389bd65 100644 --- a/056shape_shifting_recipe.cc +++ b/056shape_shifting_recipe.cc @@ -109,21 +109,13 @@ vector<recipe_ordinal> strictly_matching_shape_shifting_variants(const instructi } bool all_concrete_header_reagents_strictly_match(const instruction& inst, const recipe& variant) { - if (SIZE(inst.ingredients) < SIZE(variant.ingredients)) { - trace(9993, "transform") << "too few ingredients" << end(); - return false; - } - if (SIZE(variant.products) < SIZE(inst.products)) { - trace(9993, "transform") << "too few products" << end(); - return false; - } - for (int i = 0; i < SIZE(variant.ingredients); ++i) { + for (int i = 0; i < min(SIZE(inst.ingredients), SIZE(variant.ingredients)); ++i) { if (!concrete_type_names_strictly_match(variant.ingredients.at(i), inst.ingredients.at(i))) { trace(9993, "transform") << "concrete-type match failed: ingredient " << i << end(); return false; } } - for (int i = 0; i < SIZE(inst.products); ++i) { + for (int i = 0; i < min(SIZE(inst.products), SIZE(variant.ingredients)); ++i) { if (is_dummy(inst.products.at(i))) continue; if (!concrete_type_names_strictly_match(variant.products.at(i), inst.products.at(i))) { trace(9993, "transform") << "strict match failed: product " << i << end(); diff --git a/064list.mu b/064list.mu index 13fc581e..4aa24b04 100644 --- a/064list.mu +++ b/064list.mu @@ -277,7 +277,7 @@ scenario reverse-list [ list <- push 2, list list <- push 3, list stash [list:], list - list <- reverse list, 0 + list <- reverse list stash [reversed:], list ] trace-should-contain [ |