Permalink
Browse files

github markdown: tables

  • Loading branch information...
1 parent 09c957b commit 507e58bef8dd7d0a77247e85d3180313d44bc45e @adriaanm adriaanm committed Mar 12, 2014
Showing with 25 additions and 22 deletions.
  1. +19 −18 03-lexical-syntax.md
  2. +2 −1 05-types.md
  3. +3 −2 08-expressions.md
  4. +1 −1 14-the-scala-standard-library.md
View
@@ -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
View
@@ -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
View
@@ -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,14 +1293,14 @@ $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` |
|`(_: Int) * 2` | `(x: Int) => (x: Int) * 2` |
|`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
@@ -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

0 comments on commit 507e58b

Please sign in to comment.