def analyzeOperands(operands): analyzedOperands = pair.listMap(analyze, operands) ## Simple case: if no operands, return something that just ## passes NIL to its continuation def analyzed(env, cont): return execRands(analyzedOperands, env, cont) return analyzed
def expandQuasiquotation(exp, depth=1): """Takes a quasiquoted expression and constructs a new quoted expression. FIXME: this function is SO evil. *grin* Must clean this up. """ if not pair.isList(exp): return makeQuoted(exp) if isUnquoted(exp): if depth == 1: return textOfUnquotation(exp) else: return pair.list( Symbol("list"), makeQuoted(Symbol("unquote")), expandQuasiquotation(textOfUnquotation(exp), depth - 1)) if isQuasiquoted(exp): return pair.list( Symbol("list"), makeQuoted(Symbol("quasiquote")), expandQuasiquotation(textOfUnquotation(exp), depth + 1)) else: return pair.cons( Symbol("list"), pair.listMap(lambda subexp: expandQuasiquotation(subexp, depth), exp))