File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 1
1
package machine
2
2
3
+ import "fmt"
4
+
3
5
// Cmd (a.k.a. "Command") is a
4
6
//
5
7
// 1. sequence of executable instructions
@@ -61,3 +63,7 @@ func (cmd Cmd) call() Object {
61
63
62
64
return cmd .stack .Pop ()
63
65
}
66
+
67
+ func (cmd Cmd ) String () string {
68
+ return fmt .Sprintf ("Cmd<%d>(%d/%d)" , cmd .ip , len (cmd .args ), cmd .argc )
69
+ }
Original file line number Diff line number Diff line change 1
1
package machine
2
2
3
+ import "fmt"
4
+
3
5
// Fn (a.k.a "Builtin Function") is a special type that implement the Function
4
6
// interface. It is used to carry stdlib functions.
5
7
type Fn struct {
@@ -28,3 +30,7 @@ func (fn Fn) Feed(arg Object) Object {
28
30
func (fn Fn ) call () Object {
29
31
return fn .eval (fn .args )
30
32
}
33
+
34
+ func (fn Fn ) String () string {
35
+ return fmt .Sprintf ("Fn(%d/%d)" , len (fn .args ), fn .argc )
36
+ }
You can’t perform that action at this time.
0 commit comments