Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9708b0c

Browse filesBrowse files
committed
change Func.args from Symbol[] to Expr[], add example2
1 parent a3961b6 commit 9708b0c
Copy full SHA for 9708b0c

File tree

Expand file treeCollapse file tree

2 files changed

+10
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+10
-10
lines changed
Open diff view settings
Collapse file

‎README.md‎

Copy file name to clipboardExpand all lines: README.md
+5-5Lines changed: 5 additions & 5 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ public class Example1 {
3131

3232
public static void main(String[] args) {
3333
Expr expr = x + y * z;
34-
System.out.println(expr);
34+
System.out.println(expr); //x + y*z
3535

3636
Expr expr2 = expr.subs(x, y*y);
37-
System.out.println(expr2);
38-
System.out.println(expr2.diff(y));
37+
System.out.println(expr2); //y^2 + y*z
38+
System.out.println(expr2.diff(y)); //2*y + z
3939

4040
Func f = new Func("f1", expr2.diff(y));
41-
System.out.println(f);
41+
System.out.println(f); //2*y + z
4242

4343
BytecodeFunc func = f.toBytecodeFunc();
44-
System.out.println(func.apply(1,2));
44+
System.out.println(func.apply(1,2)); //4.0
4545
}
4646
}
4747
```
Collapse file

‎src/symjava/examples/Example1.java‎

Copy file name to clipboardExpand all lines: src/symjava/examples/Example1.java
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ public class Example1 {
1313

1414
public static void main(String[] args) {
1515
Expr expr = x + y * z;
16-
System.out.println(expr);
16+
System.out.println(expr); //x + y*z
1717

1818
Expr expr2 = expr.subs(x, y*y);
19-
System.out.println(expr2);
20-
System.out.println(expr2.diff(y));
19+
System.out.println(expr2); //y^2 + y*z
20+
System.out.println(expr2.diff(y)); //2*y + z
2121

2222
Func f = new Func("f1", expr2.diff(y));
23-
System.out.println(f);
23+
System.out.println(f); //2*y + z
2424

2525
BytecodeFunc func = f.toBytecodeFunc();
26-
System.out.println(func.apply(1,2));
26+
System.out.println(func.apply(1,2)); //4.0
2727
}
2828
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.