def __init__(self, first, rest): from scheme_builtins import scheme_valid_cdrp, SchemeError if not (rest is nil or isinstance(rest, Pair) or type(rest).__name__ == 'Promise'): print(rest, type(rest).__name__) raise SchemeError("cdr can only be a pair, nil, or a promise but was {}".format(rest)) self.first = first self.rest = rest
def __init__(self, first, rest): from scheme_builtins import scheme_valid_cdrp, SchemeError if not scheme_valid_cdrp(rest): raise SchemeError( "cdr can only be a pair, nil, or a promise but was {}".format( rest)) self.first = first self.rest = rest
def __init__(self, first, second): from scheme_builtins import scheme_valid_cdrp, SchemeError if not (second is nil or isinstance(second, Pair) or type(x).__name__ == 'Promise'): raise SchemeError( "cdr can only be a pair, nil, or a promise but was {}".format( second)) self.first = first self.second = second