Remove redundant code and add examples

This commit is contained in:
tsingbx
2024-07-30 21:06:17 +08:00
parent 03076bdc76
commit 6e24792b9b
5 changed files with 55 additions and 38 deletions

View File

@@ -1022,10 +1022,6 @@ func (b Builder) Do(da DoAction, fn Expr, args ...Expr) (ret Expr) {
// Go spec (excluding "make" and "new").
func (b Builder) BuiltinCall(fn string, args ...Expr) (ret Expr) {
switch fn {
case "max":
fallthrough
case "min":
return b.max(args...)
case "len":
if len(args) == 1 {
arg := args[0]
@@ -1132,12 +1128,6 @@ func (b Builder) BuiltinCall(fn string, args ...Expr) (ret Expr) {
panic("todo: " + fn)
}
// max return the max value for the args
func (b Builder) max(args ...Expr) (ret Expr) {
//todo
return args[len(args)-1]
}
// Println prints the arguments to stderr, followed by a newline.
func (b Builder) Println(args ...Expr) (ret Expr) {
return b.PrintEx(true, args...)