From 5059f32d0ddf36b9591ad0c14ee474ad5f2f8816 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 15 Dec 2017 00:15:47 -0800 Subject: 4160 - named marks for delimited continuations Hypothesis: this is needed to build McCarthy's amb operator. https://rosettacode.org/wiki/Amb --- 072recipe.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to '072recipe.cc') diff --git a/072recipe.cc b/072recipe.cc index eaf1baf3..e76db812 100644 --- a/072recipe.cc +++ b/072recipe.cc @@ -205,15 +205,13 @@ def f x:point -> y:point [ +error: main: product 0 has the wrong type at '2:num <- call {1: (recipe point -> point)}, 34' :(before "End resolve_ambiguous_call(r, index, inst, caller_recipe) Special-cases") -if (inst.name == "call" && first_ingredient_is_recipe_literal(inst)) { +if (inst.name == "call" && !inst.ingredients.empty() && is_recipe_literal(inst.ingredients.at(0))) { resolve_indirect_ambiguous_call(r, index, inst, caller_recipe); return; } :(code) -bool first_ingredient_is_recipe_literal(const instruction& inst) { - if (inst.ingredients.empty()) return false; - const reagent& ingredient = inst.ingredients.at(0); - return ingredient.type && ingredient.type->atom && ingredient.type->name == "recipe-literal"; +bool is_recipe_literal(const reagent& x) { + return x.type && x.type->atom && x.type->name == "recipe-literal"; } void resolve_indirect_ambiguous_call(const recipe_ordinal r, int index, instruction& inst, const recipe& caller_recipe) { instruction inst2; -- cgit 1.4.1-2-gfad0