{
if (f instanceof NamedFunction) return (PGNamedFunction) PGFuncMap.get(f);
else if (f instanceof NumberFunction) return new PGNumberFunction(f.getValue(null));
else if (f instanceof BinaryFunction)
{
BinaryFunction bf = (BinaryFunction) f;
PGFunction f1 = makeFunction(bf.first);
PGFunction s2 = makeFunction(bf.second);
return new PGBinaryFunction(f1,s2,bf.type);
}
else return null;