Skip to content

Commit

Permalink
refactoring with code
Browse files Browse the repository at this point in the history
  • Loading branch information
gyc567 committed Jul 16, 2016
1 parent 09c4224 commit 060324e
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/main/java/com/github/eric/LispComplier.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,27 @@ public static int calculate(int result, Object args) {
if (args == null) {
return result;
}
if (args instanceof Integer) {
result += (Integer) args;
return result;
}
if (args instanceof ValuePair) {
Object first = ValuePairUtils.first(args);
if (first instanceof Integer)
if (first instanceof Integer) {
result += ((Integer) first).intValue();

}else if(args instanceof Integer)
{
result+=(Integer) args;
return result;
}
}
return calculate(result, ValuePairUtils.rest(args));
}


public static Object eval(ValuePair valuePair) {
String fn = (String) valuePair.first;
Integer rt=0;
Integer rt = 0;
if (fn != null && fn.equals("+")) {
ValuePair args = (ValuePair) valuePair.rest;

rt= calculate(rt,args);

rt = calculate(rt, args);


}
Expand Down

0 comments on commit 060324e

Please sign in to comment.