feat: replace IO class with System class and remove separate IO module

- Delete wren_io.c, wren_io.h, and io.wren source files
- Remove multi-arity print overloads and IO.read/IO.time methods
- Add System class with print, printAll, write, writeAll methods to core.wren
- Update all documentation examples and README to use System.print instead of IO.print
This commit is contained in:
Bob Nystrom
2015-09-15 14:46:09 +00:00
parent f12581a674
commit aa72900a9e
491 changed files with 3285 additions and 3544 deletions
+5 -5
View File
@@ -59,7 +59,7 @@ and counting the number of times the returned value evaluates to `true`.
Iterates over the sequence, passing each element to the given `function`.
:::dart
["one", "two", "three"].each {|word| IO.print(word) }
["one", "two", "three"].each {|word| System.print(word) }
### **isEmpty**
@@ -88,7 +88,7 @@ original sequence while it is iterated.
:::dart
var doubles = [1, 2, 3].map {|n| n * 2 }
for (n in doubles) {
IO.print(n) // "2", "4", "6".
System.print(n) // "2", "4", "6".
}
The returned sequence is *lazy*. It only applies the mapping when you iterate
@@ -105,7 +105,7 @@ To force eager evaluation, just call `.toList` on the result.
var numbers = [1, 2, 3]
var doubles = numbers.map {|n| n * 2 }.toList
numbers.add(4)
IO.print(doubles) // [2, 4, 6].
System.print(doubles) // [2, 4, 6].
### **reduce**(function)
@@ -142,7 +142,7 @@ function `predicate`. If it returns `false`, the element is skipped.
:::dart
var odds = (1..10).where {|n| n % 2 == 1 }
for (n in odds) {
IO.print(n) // "1", "3", "5", "7", "9".
System.print(n) // "1", "3", "5", "7", "9".
}
The returned sequence is *lazy*. It only applies the filtering when you iterate
@@ -160,4 +160,4 @@ To force eager evaluation, just call `.toList` on the result.
var numbers = [1, 2, 3, 4, 5, 6]
var odds = numbers.where {|n| n % 2 == 1 }.toList
numbers.add(7)
IO.print(odds) // [1, 3, 5].
System.print(odds) // [1, 3, 5].