feat: add overloaded IO.print methods accepting 2-16 arguments and printList_ helper

Add 15 static overloads of IO.print in builtin/io.wren and src/wren_io.c, each delegating to a new private printList_ method that iterates over a list of objects. Update all benchmark and test files to use the new multi-argument syntax, removing explicit .toString calls and string concatenation. Add a comprehensive test/io/print.wren verifying single-argument return value, multi-argument null return, and concatenation of up to 16 arguments.
This commit is contained in:
Bob Nystrom
2014-04-09 14:48:35 +00:00
parent 786e20ba93
commit 3e5fdc2250
14 changed files with 176 additions and 25 deletions
+5 -8
View File
@@ -26,8 +26,8 @@ var stretchDepth = maxDepth + 1
var start = IO.clock
IO.print("stretch tree of depth " + stretchDepth.toString + " check: " +
new Tree(0, stretchDepth).check.toString)
IO.print("stretch tree of depth ", stretchDepth, " check: ",
new Tree(0, stretchDepth).check)
var longLivedTree = new Tree(0, maxDepth)
@@ -44,13 +44,10 @@ while (depth < stretchDepth) {
check = check + new Tree(i, depth).check + new Tree(-i, depth).check
}
IO.print((iterations * 2).toString + " trees of depth " + depth.toString +
" check: " + check.toString)
IO.print((iterations * 2), " trees of depth ", depth, " check: ", check)
iterations = iterations / 4
depth = depth + 2
}
IO.print("long lived tree of depth " + maxDepth.toString + " check: " +
longLivedTree.check.toString)
IO.print("elapsed: " + (IO.clock - start).toString)
IO.print("long lived tree of depth ", maxDepth, " check: ", longLivedTree.check)
IO.print("elapsed: ", (IO.clock - start))
+1 -1
View File
@@ -713,5 +713,5 @@ for (i in 0...20) {
}
IO.print(total)
IO.print("elapsed: " + (IO.clock - start).toString)
IO.print("elapsed: ", IO.clock - start)
+1 -1
View File
@@ -7,4 +7,4 @@ var start = IO.clock
for (i in 1..5) {
IO.print(fib.call(28))
}
IO.print("elapsed: " + (IO.clock - start).toString)
IO.print("elapsed: ", IO.clock - start)
+1 -1
View File
@@ -7,4 +7,4 @@ var sum = 0
for (i in list) sum = sum + i
IO.print(sum)
IO.print("elapsed: " + (IO.clock - start).toString)
IO.print("elapsed: ", IO.clock - start)
+1 -2
View File
@@ -65,5 +65,4 @@ for (i in 0...n) {
}
IO.print(ntoggle.value)
IO.print("elapsed: " + (IO.clock - start).toString)
IO.print("elapsed: ", IO.clock - start)