From 507e58bef8dd7d0a77247e85d3180313d44bc45e Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Tue, 11 Mar 2014 17:50:24 -0700 Subject: github markdown: tables --- 03-lexical-syntax.md | 37 +++++++++++++++++++------------------ 05-types.md | 3 ++- 08-expressions.md | 5 +++-- 14-the-scala-standard-library.md | 2 +- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/03-lexical-syntax.md b/03-lexical-syntax.md index ea82d257f0..8d9f7645e1 100644 --- a/03-lexical-syntax.md +++ b/03-lexical-syntax.md @@ -344,11 +344,12 @@ and the integer number fits in the numeric range defined by the type, then the number is converted to type _pt_ and the literal's type is _pt_. The numeric ranges given by these types are: ---------------- ----------------------- -`Byte` $-2^7$ to $2^7-1$ -`Short` $-2^{15}$ to $2^{15}-1$ -`Char` $0$ to $2^{16}-1$ ---------------- ----------------------- +| | | +|----------------|------------------------| +|`Byte` | $-2^7$ to $2^7-1$ | +|`Short` | $-2^{15}$ to $2^{15}-1$| +|`Char` | $0$ to $2^{16}-1$ | +| | ###### Example: some integer literals @@ -507,19 +508,19 @@ Because there is a predefined ### Escape Sequences -The following escape sequences are recognized in character and string -literals. - ------- ------------------------------ -`\b` `\u0008`: backspace BS -`\t` `\u0009`: horizontal tab HT -`\n` `\u000a`: linefeed LF -`\f` `\u000c`: form feed FF -`\r` `\u000d`: carriage return CR -`\"` `\u0022`: double quote " -`\'` `\u0027`: single quote ' -`\\` `\u005c`: backslash `\` ------- ------------------------------- +The following escape sequences are recognized in character and string literals. + +| | | | | +|-------|----------|-----------------|------| +| `\b` | `\u0008` | backspace | BS | +| `\t` | `\u0009` | horizontal tab | HT | +| `\n` | `\u000a` | linefeed | LF | +| `\f` | `\u000c` | form feed | FF | +| `\r` | `\u000d` | carriage return | CR | +| `\"` | `\u0022` | double quote | " | +| `\'` | `\u0027` | single quote | ' | +| `\\` | `\u005c` | backslash | `\` | + A character with Unicode between 0 and 255 may also be represented by an octal escape, i.e. a backslash ‘\’ followed by a diff --git a/05-types.md b/05-types.md index 876d8eea15..29eccb970c 100644 --- a/05-types.md +++ b/05-types.md @@ -149,12 +149,13 @@ Some type designators and their expansions are listed below. We assume a local type parameter $t$, a value `maintable` with a type member `Node` and the standard class `scala.Int`, +| | | |-------------------- | --------------------------| |t | ε.type#t | |Int | scala.type#Int | |scala.Int | scala.type#Int | |data.maintable.Node | data.maintable.type#Node | -|-------------------- | --------------------------| + ### Parameterized Types diff --git a/08-expressions.md b/08-expressions.md index 4adf23c63e..8331bcaa1c 100644 --- a/08-expressions.md +++ b/08-expressions.md @@ -438,12 +438,13 @@ parameterlist `()`. The method values in the left column are each equivalent to the [anonymous functions](#anonymous-functions) on their right. +| | | |------------------------------ | --------------------------------------------| |`Math.sin _` | `x => Math.sin(x)` | |`Array.range _` | `(x1, x2) => Array.range(x1, x2)` | |`List.map2 _` | `(x1, x2) => (x3) => List.map2(x1, x2)(x3)` | |`List.map2(xs, ys)_` | `x => List.map2(xs, ys)(x)` | -|------------------------------ | --------------------------------------------| + Note that a space is necessary between a method name and the trailing underscore because otherwise the underscore would be considered part of the name. @@ -1292,6 +1293,7 @@ $e'$ results from $e$ by replacing each underscore section $u_i$ by $u_i'$. The anonymous functions in the left column use placeholder syntax. Each of these is equivalent to the anonymous function on its right. +| | | |---------------------------|----------------------------| |`_ + 1` | `x => x + 1` | |`_ * _` | `(x1, x2) => x1 * x2` | @@ -1299,7 +1301,6 @@ syntax. Each of these is equivalent to the anonymous function on its right. |`if (_) x else y` | `z => if (z) x else y` | |`_.map(f)` | `x => x.map(f)` | |`_.map(_ + 1)` | `x => x.map(y => y + 1)` | -|---------------------------|----------------------------| ## Constant Expressions diff --git a/14-the-scala-standard-library.md b/14-the-scala-standard-library.md index 37174b8af3..068f886e19 100644 --- a/14-the-scala-standard-library.md +++ b/14-the-scala-standard-library.md @@ -426,12 +426,12 @@ Because of the syntactic sugar for `apply` and `update` operations, we have the following correspondences between Scala and Java/C# code for operations on an array `xs`: +| | | |------------------|------------| |_Scala_ |_Java/C#_ | |`xs.length` |`xs.length` | |`xs(i)` |`xs[i]` | |`xs(i) = e` |`xs[i] = e` | -|------------------|------------| Two implicit conversions exist in `Predef` that are frequently applied to arrays: a conversion to `scala.collection.mutable.ArrayOps` and a conversion to -- cgit v1.2.3