# eoSymLambdaMutate.cpp

    00001 #include <eoSymLambdaMutate.h>
    00002 #include "FunDef.h"
    00003 #include "NodeSelector.h"
    00004
    00005 Sym compress(Sym sym, NodeSelector& sel) {
    00006
    00007     return ::compress(sym);
    00008
    00009     NodeSelector::NodeSelection s = sel.select_node(sym);
    00010
    00011     Sym f = SymLambda( s.subtree());
    00012
    00013     if (f == s.subtree()) { return sym; }
    00014
    00015     return insert_subtree(sym, s.idx(), f);
    00016 }
    00017
    00018 extern Sym expand(Sym sym, NodeSelector& sel) {
    00019
    00020     return ::expand_all(sym);
    00021
    00022     NodeSelector::NodeSelection s = sel.select_node(sym);
    00023
    00024     Sym f = SymUnlambda( s.subtree());
    00025
    00026     if (f == s.subtree()) { return sym; }
    00027
    00028     return insert_subtree(sym, s.idx(), f);
    00029 }