about summary refs log tree commit diff stats
path: root/072recipe.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2017-12-15 00:15:47 -0800
committerKartik K. Agaram <vc@akkartik.com>2017-12-15 00:15:47 -0800
commit5059f32d0ddf36b9591ad0c14ee474ad5f2f8816 (patch)
treeebe215d694644fc519ad1c4dcee499d739138141 /072recipe.cc
parent1cd833619e355c70d5d96a208cd67ba3a3ccb937 (diff)
downloadmu-5059f32d0ddf36b9591ad0c14ee474ad5f2f8816.tar.gz
4160 - named marks for delimited continuations
Hypothesis: this is needed to build McCarthy's amb operator.
  https://rosettacode.org/wiki/Amb
Diffstat (limited to '072recipe.cc')
-rw-r--r--072recipe.cc8
1 files changed, 3 insertions, 5 deletions
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;