9 auto& world = type->world();
10 auto [a, b] = arg->
projs<2>();
11 auto [n, m] = callee->as<
App>()->decurry()->args<2>([](
auto def) {
return Lit::isa(def); });
13 if (n && *n == 0)
return b;
14 if (m && *m == 0)
return a;
18 for (
size_t i = 0, e = *n; i != e; ++i)
19 defs.emplace_back(a->proj(e, i));
20 for (
size_t i = 0, e = *m; i != e; ++i)
21 defs.emplace_back(b->proj(e, i));
22 return world.tuple(defs);
55 auto& w = type->world();
56 auto callee = c->as<
App>();
57 auto is_os = callee->
arg();
58 auto [n_i, Is, n_o, Os, f] = is_os->
projs<5>();
59 auto [r, s] = callee->decurry()->args<2>();
68 if (lr && ls && *lr == 1 && *ls == 1)
return w.app(f, arg);
71 auto args = arg->
projs(*l_in);
73 if (lr && std::ranges::all_of(args, [](
const Def* arg) {
return arg->isa<
Prod>(); })) {
74 auto shapes = s->projs(*lr);
78 auto elems =
DefVec(*s_n, [&, f = f](
size_t s_i) {
79 auto inner_args =
DefVec(args.size(), [&](
size_t i) { return args[i]->proj(*s_n, s_i); });
81 return w.app(f, inner_args);
83 auto app_zip = w.app(w.annex<
zip>(), {w.lit_nat(*lr - 1), w.tuple(shapes.view().subspan(1))});
84 return w.app(w.app(app_zip, is_os), inner_args);
87 return w.tuple(elems);