Deploy to GitHub Pages:

This commit is contained in:
Travis CI
2021-02-06 15:58:10 +00:00
parent a56214433f
commit 30ea6fa8b4
7 changed files with 105 additions and 11 deletions

View File

@ -60,9 +60,26 @@
</nav>
<main>
<h1>Scheduler Class</h1>
<p><strong>TODO</strong></p>
<h2>Methods <a href="#methods" name="methods" class="header-anchor">#</a></h2>
<p><strong>TODO</strong></p>
<p>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 <em>long running</em> methods in the File or Timer classes which suspend the current fiber so that Wren can carry out other tasks in the meantime.</p>
<h2>Static Method <a href="#static-method" name="static-method" class="header-anchor">#</a></h2>
<h3>Scheduler.<strong>add</strong>(callable) <a href="#scheduler.add(callable)" name="scheduler.add(callable)" class="header-anchor">#</a></h3>
<p>Adds a new fiber to the scheduler&rsquo;s fibers list. This fiber calls <code>callable</code> and then transfers to the next fiber in the list, if there is one.</p>
<p><code>callable</code> is a function or other object which has a call() method.</p>
<pre class="snippet">
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
</pre>
</main>
</div>
<footer>

View File

@ -60,9 +60,11 @@
</nav>
<main>
<h1>Timer Class</h1>
<p><strong>TODO</strong></p>
<h2>Methods <a href="#methods" name="methods" class="header-anchor">#</a></h2>
<p><strong>TODO</strong></p>
<h2>Static Method <a href="#static-method" name="static-method" class="header-anchor">#</a></h2>
<h3>Timer.<strong>sleep</strong>(milliseconds) <a href="#timer.sleep(milliseconds)" name="timer.sleep(milliseconds)" class="header-anchor">#</a></h3>
<p>Suspends the current fiber for the given number of milliseconds. It is a runtime error if this is not a non-negative number.</p>
<p>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.</p>
<p>Note that this method also suspends the System.clock method which will not give the correct running time for a program as a result.</p>
</main>
</div>
<footer>

View File

@ -92,7 +92,16 @@
<p>Creates a new empty list. Equivalent to <code>[]</code>.</p>
<h2>Methods <a href="#methods" name="methods" class="header-anchor">#</a></h2>
<h3><strong>add</strong>(item) <a href="#add(item)" name="add(item)" class="header-anchor">#</a></h3>
<p>Appends <code>item</code> to the end of the list.</p>
<p>Appends <code>item</code> to the end of the list. Returns the added item.</p>
<h3><strong>addAll</strong>(other) <a href="#addall(other)" name="addall(other)" class="header-anchor">#</a></h3>
<p>Appends each element of <code>other</code> in the same order to the end of the list. <code>other</code> must be <a href="../../control-flow.html#the-iterator-protocol">an iterable</a>.</p>
<pre class="snippet">
var list = [0, 1, 2, 3, 4]
list.addAll([5, 6])
System.print(list) //> [0, 1, 2, 3, 4, 5, 6]
</pre>
<p>Returns the added items.</p>
<h3><strong>clear</strong>() <a href="#clear()" name="clear()" class="header-anchor">#</a></h3>
<p>Removes all elements from the list.</p>
<h3><strong>count</strong> <a href="#count" name="count" class="header-anchor">#</a></h3>
@ -187,7 +196,15 @@ var list = ["a", "b", "c"]
System.print(list[1]) //> b
</pre>
<p>It is a runtime error if the index is not an integer or is out of bounds.</p>
<p>If <code>index</code> is a <a href="range.html">Range</a>, a new list is populated from the elements
in the range.</p>
<pre class="snippet">
var list = ["a", "b", "c"]
System.print(list[0..1]) //> [a, b]
</pre>
<p>You can use <code>list[0..-1]</code> to shallow-copy a list.</p>
<p>It is a runtime error if the index is not an integer or range, or is out of bounds.</p>
<h3><strong>[</strong>index<strong>]=</strong>(item) operator <a href="#[index]=(item)-operator" name="[index]=(item)-operator" class="header-anchor">#</a></h3>
<p>Replaces the element at <code>index</code> with <code>item</code>. If <code>index</code> is negative, it counts
backwards from the end of the list where <code>-1</code> is the last element.</p>
@ -199,12 +216,20 @@ System.print(list) //> [a, new, c]
<p>It is a runtime error if the index is not an integer or is out of bounds.</p>
<h3><strong>+</strong>(other) operator <a href="#+(other)-operator" name="+(other)-operator" class="header-anchor">#</a></h3>
<p>Appends a list to the end of the list (concatenation). <code>other</code> must be a <code>List</code>.</p>
<p>Appends a list to the end of the list (concatenation). <code>other</code> must be <a href="../../control-flow.html#the-iterator-protocol">an iterable</a>.</p>
<pre class="snippet">
var letters = ["a", "b", "c"]
var other = ["d", "e", "f"]
var combined = letters + other
System.print(combined) //> [a, b, c, d, e, f]
</pre>
<h3><strong>*</strong>(count) operator <a href="#\(count)-operator" name="\(count)-operator" class="header-anchor">#</a></h3>
<p>Creates a new list by repeating this one <code>count</code> times. It is a runtime error if <code>count</code> is not a non-negative integer.</p>
<pre class="snippet">
var digits = [1, 2]
var tripleDigits = digits * 3
System.print(tripleDigits) //> [1, 2, 1, 2, 1, 2]
</pre>
</main>
</div>

View File

@ -82,7 +82,11 @@
</nav>
<main>
<h1>Map Class</h1>
<p>An associative collection that maps keys to values. More details <a href="../../maps.html">here</a>.</p>
<p>Extends <a href="sequence.html">Sequence</a>.</p>
<p>An associative collection that maps keys to values. More details <a href="../../maps.html">here</a>.</p>
<h2>Static Method <a href="#static-method" name="static-method" class="header-anchor">#</a></h2>
<h3>Map.<strong>new</strong>() <a href="#map.new()" name="map.new()" class="header-anchor">#</a></h3>
<p>Creates a new empty map. Equivalent to <code>{}</code>.</p>
<h2>Methods <a href="#methods" name="methods" class="header-anchor">#</a></h2>
<h3><strong>clear</strong>() <a href="#clear()" name="clear()" class="header-anchor">#</a></h3>
<p>Removes all entries from the map.</p>
@ -118,6 +122,19 @@ replaces the previous association.</p>
<p>It is a runtime error if the key is not a <a href="bool.html">Bool</a>,
<a href="class.html">Class</a>, <a href="null.html">Null</a>, <a href="num.html">Num</a>, <a href="range.html">Range</a>,
or <a href="string.html">String</a>.</p>
<h3><strong>iterate</strong>(iterator), <strong>iteratorValue</strong>(iterator) <a href="#iterate(iterator),-iteratorvalue(iterator)" name="iterate(iterator),-iteratorvalue(iterator)" class="header-anchor">#</a></h3>
<p>Implements the <a href="../../control-flow.html#the-iterator-protocol">iterator protocol</a> for iterating over the keys and values of a map at the same time.</p>
<p>When a map (as opposed to its keys or values separately) is iterated over, each key/value pair is wrapped in a <code>MapEntry</code> object. <code>MapEntry</code> is a small helper class which has read-only <code>key</code> and <code>value</code> properties and a familiar <code>toString</code> representation.</p>
<pre class="snippet">
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
}
</pre>
<p>All map entries will be iterated over, but may be in any order, and may even change between invocations of Wren.</p>
</main>
</div>
<footer>

View File

@ -95,7 +95,7 @@
<h3>Num.<strong>pi</strong> <a href="#num.pi" name="num.pi" class="header-anchor">#</a></h3>
<p>The value of &pi;.</p>
<h3>Num.<strong>tau</strong> <a href="#num.tau" name="num.tau" class="header-anchor">#</a></h3>
<p>The value of &tau;.</p>
<p>The value of &tau;. This is equivalent to <code>2 * Num.pi</code>.</p>
<h3>Num.<strong>largest</strong> <a href="#num.largest" name="num.largest" class="header-anchor">#</a></h3>
<p>The largest representable numeric value.</p>
<h3>Num.<strong>smallest</strong> <a href="#num.smallest" name="num.smallest" class="header-anchor">#</a></h3>
@ -116,6 +116,8 @@ System.print( (-123).abs ) //> 123
<h3><strong>atan</strong>(x) <a href="#atan(x)" name="atan(x)" class="header-anchor">#</a></h3>
<p>The arc tangent of the number when divided by <code>x</code>, using the signs of the two
numbers to determine the quadrant of the result.</p>
<h3><strong>cbrt</strong> <a href="#cbrt" name="cbrt" class="header-anchor">#</a></h3>
<p>The cube root of the number.</p>
<h3><strong>ceil</strong> <a href="#ceil" name="ceil" class="header-anchor">#</a></h3>
<p>Rounds the number up to the nearest integer.</p>
<pre class="snippet">
@ -132,6 +134,14 @@ System.print(1.5.floor) //> 1
System.print((-3.2).floor) //> -4
</pre>
<h3><strong>fraction</strong> <a href="#fraction" name="fraction" class="header-anchor">#</a></h3>
<p>The fractional part of a number i.e. the part after any decimal point.</p>
<p>The returned value has the same sign as <code>this</code>.</p>
<pre class="snippet">
System.print(1.5.fraction) //> 0.5
System.print((-3.2).fraction) //> -0.2
</pre>
<h3><strong>isInfinity</strong> <a href="#isinfinity" name="isinfinity" class="header-anchor">#</a></h3>
<p>Whether the number is positive or negative infinity or not.</p>
<pre class="snippet">
@ -182,6 +192,16 @@ System.print((-3.7).round) //> -4
<p>The square root of the number. Returns <code>nan</code> if the number is negative.</p>
<h3><strong>tan</strong> <a href="#tan" name="tan" class="header-anchor">#</a></h3>
<p>The tangent of the number.</p>
<h3><strong>toString</strong> <a href="#tostring" name="tostring" class="header-anchor">#</a></h3>
<p>The string representation of the number.</p>
<h3><strong>truncate</strong> <a href="#truncate" name="truncate" class="header-anchor">#</a></h3>
<p>Rounds the number to the nearest integer towards zero.</p>
<p>It is therefore equivalent to <code>floor</code> if the number is non-negative or <code>ceil</code> if it is negative.</p>
<pre class="snippet">
System.print(1.5.truncate) //> 1
System.print((-3.2).truncate) //> -3
</pre>
<h3><strong>-</strong> operator <a href="#--operator" name="--operator" class="header-anchor">#</a></h3>
<p>Negates the number.</p>
<pre class="snippet">
@ -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
<code>true</code> only where the corresponding bits of one or both inputs were <code>true</code>.</p>
<p>It is a runtime error if <code>other</code> is not a number.</p>
<h3><strong>^</strong>(other) operator <a href="#^(other)-operator" name="^(other)-operator" class="header-anchor">#</a></h3>
<p>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 <code>true</code> only where the corresponding bits of one (but not both) inputs were <code>true</code>. Each bit is therefore <code>false</code> if the corresponding bits of both inputs were either both <code>true</code> or both <code>false</code>.</p>
<p>It is a runtime error if <code>other</code> is not a number.</p>
<h3><strong>&lt;&lt;</strong>(other) operator <a href="#<<(other)-operator" name="<<(other)-operator" class="header-anchor">#</a></h3>
<p>Performs a bitwise left shift on the number. Internally, both numbers are first converted to 32-bit unsigned values and C&rsquo;s left shift operator is then applied to them.</p>
<p>It is a runtime error if <code>other</code> is not a number.</p>
<h3><strong>&gt;&gt;</strong>(other) operator <a href="#>&gt;(other)-operator&rdquo; name=&rdquo;&gt;&gt;(other)-operator&rdquo; class=&rdquo;header-anchor&rdquo;&gt;#</a></h3>
<p>Performs a bitwise right shift on the number. Internally, both numbers are first converted to 32-bit unsigned values and C&rsquo;s right shift operator is then applied to them.</p>
<p>It is a runtime error if <code>other</code> is not a number.</p>
<h3><strong>..</strong>(other) operator <a href="#..(other)-operator" name="..(other)-operator" class="header-anchor">#</a></h3>
<p>Creates a <a href="range.html">Range</a> representing a consecutive range of numbers
from the beginning number to the ending number.</p>

View File

@ -116,6 +116,9 @@ System.write(4 + 5) //> 9
<p>In the above example, the result of <code>4 + 5</code> is printed, and then the prompt is
printed on the same line because no newline character was printed afterwards.</p>
<h3>System.<strong>writeAll</strong>(sequence) <a href="#system.writeall(sequence)" name="system.writeall(sequence)" class="header-anchor">#</a></h3>
<p>Iterates over <code>sequence</code> and prints each element, but does not print a newline
character afterwards. Each element is converted to a string by calling <code>toString</code> on it.</p>
</main>
</div>
<footer>

View File

@ -132,6 +132,7 @@ from other languages:</p>
0.0314159e02
0.0314159e+02
314.159e-02
0xcaffe2
</pre>
<p>Numbers are instances of the <a href="modules/core/num.html">Num</a> class.</p>