awlval* awlval_vals_dict(awlval* x) { int count = dict_count(x->d); awlval** vals = (awlval**)dict_all_vals(x->d); awlval* v = awlval_qexpr(); for (int i = 0; i < count; i++) { awlval_add(v, awlval_copy(vals[i])); } free(vals); return v; }
static void zlval_dict_print(stringbuilder_t* sb, const dict* d) { stringbuilder_write(sb, "["); int count = dict_count(d); char** keys = dict_all_keys(d); zlval** vals = (zlval**)dict_all_vals(d); for (int i = 0; i < count; i++) { stringbuilder_write(sb, ":'%s'", keys[i]); stringbuilder_write(sb, " "); zlval_write_sb(sb, vals[i]); if (i != (count - 1)) { stringbuilder_write(sb, " "); } } free(keys); free(vals); stringbuilder_write(sb, "]"); }