display = lambda x: x
def has_value(connector):
    return connector("has_value")

def get_value(connector):
    return connector("value")

def set_value(connector, new_value, informant):
    return connector("set_value")(new_value, informant)

def forget_value(connector, retractor):
    return connector("forget")(retractor)

def connect(connector, new_constraint):
    return connector("connect")(new_constraint)
def probe(name, connector):
    def print_probe(value):
        display("Probe: " + name + " = " + str(value))
    def process_new_value():
        print_probe(get_value(connector))
    def process_forget_value():
        print_probe("?")
    def me(request):
        return (process_new_value()
                if request == "I have a value."
                else process_forget_value()
                if request == "I lost my value."
                else error("unknown request -- probe", request))
    connect(connector, me)
    return me
