From 048a33c24fe4b1e937391693e3556e1edfdbfbcd Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 27 Sep 2016 10:28:14 -0700 Subject: 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 --- 056shape_shifting_recipe.cc | 12 ++---------- 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 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 [ -- cgit 1.4.1-2-gfad0