Esempio n. 1
0
  public IExpr evaluate(final IAST ast) {
    Validate.checkSize(ast, 3);

    if (ast.get(1).isSymbol()) {
      if (ast.get(2).isAST("Blank")) {
        IAST blank = (IAST) ast.get(2);
        if (blank.size() == 1) {
          return F.$p((ISymbol) ast.get(1));
        }
        if (blank.size() == 2) {
          return F.$p((ISymbol) ast.get(1), blank.get(1));
        }
      }
      if (ast.get(2).isPattern()) {
        IPattern blank = (IPattern) ast.get(2);
        if (blank.isBlank()) {
          return F.$p((ISymbol) ast.get(1), blank.getCondition());
        }
      }
    }
    return null;
  }
Esempio n. 2
0
 public int visit(IPattern element) {
   return element.hashCode();
 }