def maybe_quote(quote_some, x): x = maybe_type(x) return app( x, QUOTE(none), lambda y: qapp(quote(some), app(quote_some, y)), )
def enum_contains(qxs, qy): return app(LESS, qapp(quote(box), qy), qxs)
def list_quote(quote_item, xs): return app( xs, QUOTE(nil), lambda h, t: qapp(quote(cons), app(quote_item, h), list_quote(t)), )
def num_quote(x): return app(x, QUOTE(zero), lambda px: qapp(quote(succ), num_quote(px)))
def sum_quote(quote_inl, quote_inr, xy): return app( xy, lambda x: qapp(quote(inl), app(quote_inl, x)), lambda y: qapp(quote(inr), app(quote_inr, y)), )
def prod_quote(quote_fst, quote_snd, xy): return app( xy, lambda x, y: qapp(quote(pair), app(quote_fst, x), app(quote_snd, y)), )
def qfix(qf): return EVAL(qf, qapp(quote(qfix), qf))
def enum_contains(qxs, qy): return QLESS(qapp(quote(box), qy), qxs)
def stream_quote(quote_item, xs): return xs(lambda h, t: qapp(QUOTE(stream_cons), quote_item(h), stream_quote(quote_item, t)))
def list_quote(quote_item, xs): return xs(QUOTE(nil), lambda h, t: qapp(quote(cons), quote_item(h), list_quote(t)))
def sum_quote(quote_inl, quote_inr, xy): return xy(lambda x: qapp(quote(inl), quote_inl(x)), lambda y: qapp(quote(inr), quote_inr(y)))
def prod_quote(quote_fst, quote_snd, xy): return xy(lambda x, y: qapp(quote(pair), quote_fst(x), quote_snd(y)))
def maybe_quote(quote_some, x): x = maybe_type(x) return x(QUOTE(none), lambda y: qapp(quote(some), quote_some(y)))