about summary refs log blame commit diff stats
path: root/cpp/030length
blob: 7b5c52be9420d1081683bbb65240f82f02ee0db0 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                     
                      







                                                        
                                                  



                                                     
:(scenario "array_length")
recipe main [
  1:integer <- copy 3:literal
  2:integer <- copy 14:literal
  3:integer <- copy 15:literal
  4:integer <- copy 16:literal
  5:integer <- length 1:array:integer
]
+run: instruction main/4
+mem: storing 3 in location 5

:(before "End Globals")
const int LENGTH = 31;
:(before "End Primitive Recipe Numbers")
Recipe_number["length"] = LENGTH;
assert(Next_recipe_number == LENGTH);
Next_recipe_number++;
:(before "End Primitive Recipe Implementations")
case LENGTH: {
  reagent x = canonize(instructions[pc].ingredients[0]);
  vector<int> result;
//?   cout << "length: " << x.value << '\n'; //? 1
  result.push_back(Memory[x.value]);
  write_memory(instructions[pc].products[0], result);
  break;
}