https://github.com/akkartik/mu/blob/master/058to_text.cc

     1 //: Primitive to convert any type to text (array of characters).
     2 //: Later layers will allow us to override this to do something smarter for
     3 //: specific types.
     4
     5 :(before "End Primitive Recipe Declarations")
     6 TO_TEXT,
     7 :(before "End Primitive Recipe Numbers")
     8 put(Recipe_ordinal, "to-text", TO_TEXT);
     9 :(before "End Primitive Recipe Checks")
    10 case TO_TEXT: {
    11   if (SIZE(inst.ingredients) != 1) {
    12     raise << maybe(get(Recipe, r).name) << "'to-text' requires a single ingredient, but got '" << to_original_string(inst) << "'\n" << end();
    13     break;
    14   }
    15   // can handle any type
    16   break;
    17 }
    18 :(before "End Primitive Recipe Implementations")
    19 case TO_TEXT: {
    20   products.resize(1);
    21   products.at(0).push_back(/*alloc id*/0);
    22   products.at(0).push_back(new_mu_text(inspect(current_instruction().ingredients.at(0), ingredients.at(0))));
    23   break;
    24 }