From 30ea6fa8b44f62bfdc83c2bc42fb9bbc2fc7c030 Mon Sep 17 00:00:00 2001
From: Travis CI <>
Date: Sat, 6 Feb 2021 15:58:10 +0000
Subject: [PATCH] Deploy to GitHub Pages:
---
cli/modules/scheduler/scheduler.html | 23 ++++++++++++++++++---
cli/modules/timer/timer.html | 8 ++++---
modules/core/list.html | 31 +++++++++++++++++++++++++---
modules/core/map.html | 19 ++++++++++++++++-
modules/core/num.html | 31 +++++++++++++++++++++++++++-
modules/core/system.html | 3 +++
values.html | 1 +
7 files changed, 105 insertions(+), 11 deletions(-)
diff --git a/cli/modules/scheduler/scheduler.html b/cli/modules/scheduler/scheduler.html
index 8d6944e6..ed7dba9e 100644
--- a/cli/modules/scheduler/scheduler.html
+++ b/cli/modules/scheduler/scheduler.html
@@ -60,9 +60,26 @@
Scheduler Class
- TODO
-Methods
-TODO
+ The Scheduler class maintains a list of fibers, to be started one after the other, when a signal to do so is received. The signal (a private method call) is typically transmitted by long running methods in the File or Timer classes which suspend the current fiber so that Wren can carry out other tasks in the meantime.
+Static Method
+Scheduler.add (callable)
+Adds a new fiber to the scheduler’s fibers list. This fiber calls callable and then transfers to the next fiber in the list, if there is one.
+callable is a function or other object which has a call() method.
+
+var a = 3
+
+Scheduler.add {
+ a = a * a
+}
+
+Scheduler.add {
+ a = a + 1
+}
+
+System.print(a) // still 3
+Timer.sleep(3000) // wait 3 seconds
+System.print(a) // now 3 * 3 + 1 = 10
+
diff --git a/cli/modules/timer/timer.html b/cli/modules/timer/timer.html
index c3182deb..c8f378af 100644
--- a/cli/modules/timer/timer.html
+++ b/cli/modules/timer/timer.html
@@ -60,9 +60,11 @@
Timer Class
- TODO
-Methods
-TODO
+ Static Method
+Timer.sleep (milliseconds)
+Suspends the current fiber for the given number of milliseconds. It is a runtime error if this is not a non-negative number.
+This method is often used in conjunction with the Scheduler class which runs any scheduled tasks in separate fibers whilst the current fiber is sleeping.
+Note that this method also suspends the System.clock method which will not give the correct running time for a program as a result.
diff --git a/modules/core/list.html b/modules/core/list.html
index b99c9d99..39a5eca0 100644
--- a/modules/core/list.html
+++ b/modules/core/list.html
@@ -92,7 +92,16 @@
Creates a new empty list. Equivalent to [].
Methods
add (item)
-Appends item to the end of the list.
+Appends item to the end of the list. Returns the added item.
+addAll (other)
+Appends each element of other in the same order to the end of the list. other must be an iterable .
+
+var list = [0, 1, 2, 3, 4]
+list.addAll([5, 6])
+System.print(list) //> [0, 1, 2, 3, 4, 5, 6]
+
+
+Returns the added items.
clear ()
Removes all elements from the list.
count
@@ -187,7 +196,15 @@ var list = ["a", "b", "c"]
System.print(list[1]) //> b
-It is a runtime error if the index is not an integer or is out of bounds.
+If index is a Range , a new list is populated from the elements
+in the range.
+
+var list = ["a", "b", "c"]
+System.print(list[0..1]) //> [a, b]
+
+
+You can use list[0..-1] to shallow-copy a list.
+It is a runtime error if the index is not an integer or range, or is out of bounds.
[ index]= (item) operator
Replaces the element at index with item. If index is negative, it counts
backwards from the end of the list where -1 is the last element.
@@ -199,12 +216,20 @@ System.print(list) //> [a, new, c]
It is a runtime error if the index is not an integer or is out of bounds.
+ (other) operator
-Appends a list to the end of the list (concatenation). other must be a List.
+Appends a list to the end of the list (concatenation). other must be an iterable .
var letters = ["a", "b", "c"]
var other = ["d", "e", "f"]
var combined = letters + other
System.print(combined) //> [a, b, c, d, e, f]
+
+
+* (count) operator
+Creates a new list by repeating this one count times. It is a runtime error if count is not a non-negative integer.
+
+var digits = [1, 2]
+var tripleDigits = digits * 3
+System.print(tripleDigits) //> [1, 2, 1, 2, 1, 2]
diff --git a/modules/core/map.html b/modules/core/map.html
index fed3afa5..34035e76 100644
--- a/modules/core/map.html
+++ b/modules/core/map.html
@@ -82,7 +82,11 @@
Map Class
- An associative collection that maps keys to values. More details here .
+ Extends Sequence .
+An associative collection that maps keys to values. More details here .
+Static Method
+Map.new ()
+Creates a new empty map. Equivalent to {}.
Methods
clear ()
Removes all entries from the map.
@@ -118,6 +122,19 @@ replaces the previous association.
It is a runtime error if the key is not a Bool ,
Class , Null , Num , Range ,
or String .
+iterate (iterator), iteratorValue (iterator)
+Implements the iterator protocol for iterating over the keys and values of a map at the same time.
+When a map (as opposed to its keys or values separately) is iterated over, each key/value pair is wrapped in a MapEntry object. MapEntry is a small helper class which has read-only key and value properties and a familiar toString representation.
+
+var map = {"paul": "mccartney"}
+for (entry in map) {
+ System.print(entry.type) // MapEntry
+ System.print(entry.key + " " + entry.value) // paul mccartney
+ System.print(entry) // paul:mccartney
+}
+
+
+All map entries will be iterated over, but may be in any order, and may even change between invocations of Wren.
diff --git a/modules/core/num.html b/modules/core/num.html
index e2a01cb3..72946de6 100644
--- a/modules/core/num.html
+++ b/modules/core/num.html
@@ -95,7 +95,7 @@
Num.pi
The value of π.
Num.tau
-The value of τ.
+The value of τ. This is equivalent to 2 * Num.pi.
Num.largest
The largest representable numeric value.
Num.smallest
@@ -116,6 +116,8 @@ System.print( (-123).abs ) //> 123
atan (x)
The arc tangent of the number when divided by x, using the signs of the two
numbers to determine the quadrant of the result.
+cbrt
+The cube root of the number.
ceil
Rounds the number up to the nearest integer.
@@ -132,6 +134,14 @@ System.print(1.5.floor) //> 1
System.print((-3.2).floor) //> -4
+fraction
+The fractional part of a number i.e. the part after any decimal point.
+The returned value has the same sign as this.
+
+System.print(1.5.fraction) //> 0.5
+System.print((-3.2).fraction) //> -0.2
+
+
isInfinity
Whether the number is positive or negative infinity or not.
@@ -182,6 +192,16 @@ System.print((-3.7).round) //> -4
The square root of the number. Returns nan if the number is negative.
tan
The tangent of the number.
+toString
+The string representation of the number.
+truncate
+Rounds the number to the nearest integer towards zero.
+It is therefore equivalent to floor if the number is non-negative or ceil if it is negative.
+
+System.print(1.5.truncate) //> 1
+System.print((-3.2).truncate) //> -3
+
+
- operator
Negates the number.
@@ -215,6 +235,15 @@ unsigned values. The result is then a 32-bit unsigned number where each bit is
unsigned values. The result is then a 32-bit unsigned number where each bit is
true only where the corresponding bits of one or both inputs were true.
It is a runtime error if other is not a number.
+^ (other) operator
+Performs bitwise exclusive or on the number. Both numbers are first converted to 32-bit unsigned values. The result is then a 32-bit unsigned number where each bit is true only where the corresponding bits of one (but not both) inputs were true. Each bit is therefore false if the corresponding bits of both inputs were either both true or both false.
+It is a runtime error if other is not a number.
+<< (other) operator
+Performs a bitwise left shift on the number. Internally, both numbers are first converted to 32-bit unsigned values and C’s left shift operator is then applied to them.
+It is a runtime error if other is not a number.
+>> (other) operator
Creates a Range representing a consecutive range of numbers
from the beginning number to the ending number.
diff --git a/modules/core/system.html b/modules/core/system.html
index eebb361c..63184e36 100644
--- a/modules/core/system.html
+++ b/modules/core/system.html
@@ -116,6 +116,9 @@ System.write(4 + 5) //> 9
In the above example, the result of 4 + 5 is printed, and then the prompt is
printed on the same line because no newline character was printed afterwards.
+System.writeAll (sequence)
+Iterates over sequence and prints each element, but does not print a newline
+character afterwards. Each element is converted to a string by calling toString on it.
diff --git a/values.html b/values.html
index 1572e7ac..4600354d 100644
--- a/values.html
+++ b/values.html
@@ -132,6 +132,7 @@ from other languages:
0.0314159e02
0.0314159e+02
314.159e-02
+0xcaffe2
Numbers are instances of the Num class.