Example #1
0
def maybe_quote(quote_some, x):
    x = maybe_type(x)
    return app(
        x,
        QUOTE(none),
        lambda y: qapp(quote(some), app(quote_some, y)),
    )
Example #2
0
def enum_contains(qxs, qy):
    return app(LESS, qapp(quote(box), qy), qxs)
Example #3
0
def list_quote(quote_item, xs):
    return app(
        xs,
        QUOTE(nil),
        lambda h, t: qapp(quote(cons), app(quote_item, h), list_quote(t)),
    )
Example #4
0
def num_quote(x):
    return app(x, QUOTE(zero), lambda px: qapp(quote(succ), num_quote(px)))
Example #5
0
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)),
    )
Example #6
0
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)),
    )
Example #7
0
def qfix(qf):
    return EVAL(qf, qapp(quote(qfix), qf))
Example #8
0
def enum_contains(qxs, qy):
    return QLESS(qapp(quote(box), qy), qxs)
Example #9
0
def stream_quote(quote_item, xs):
    return xs(lambda h, t: qapp(QUOTE(stream_cons),
                                quote_item(h),
                                stream_quote(quote_item, t)))
Example #10
0
def list_quote(quote_item, xs):
    return xs(QUOTE(nil), lambda h, t:
              qapp(quote(cons), quote_item(h), list_quote(t)))
Example #11
0
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)))
Example #12
0
def prod_quote(quote_fst, quote_snd, xy):
    return xy(lambda x, y: qapp(quote(pair), quote_fst(x), quote_snd(y)))
Example #13
0
def maybe_quote(quote_some, x):
    x = maybe_type(x)
    return x(QUOTE(none), lambda y: qapp(quote(some), quote_some(y)))