Skip to content

Commit

Permalink
github markdown: tables
Browse files Browse the repository at this point in the history
  • Loading branch information
adriaanm committed Mar 12, 2014
1 parent 09c957b commit 507e58b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
37 changes: 19 additions & 18 deletions 03-lexical-syntax.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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 then the number is converted to type _pt_ and the literal's type
is _pt_. The numeric ranges given by these types are: is _pt_. The numeric ranges given by these types are:


--------------- ----------------------- | | |
`Byte` $-2^7$ to $2^7-1$ |----------------|------------------------|
`Short` $-2^{15}$ to $2^{15}-1$ |`Byte` | $-2^7$ to $2^7-1$ |
`Char` $0$ to $2^{16}-1$ |`Short` | $-2^{15}$ to $2^{15}-1$|
--------------- ----------------------- |`Char` | $0$ to $2^{16}-1$ |
| |


###### Example: some integer literals ###### Example: some integer literals


Expand Down Expand Up @@ -507,19 +508,19 @@ Because there is a predefined


### Escape Sequences ### Escape Sequences


The following escape sequences are recognized in character and string The following escape sequences are recognized in character and string literals.
literals.

| | | | |
------ ------------------------------ |-------|----------|-----------------|------|
`\b` `\u0008`: backspace BS | `\b` | `\u0008` | backspace | BS |
`\t` `\u0009`: horizontal tab HT | `\t` | `\u0009` | horizontal tab | HT |
`\n` `\u000a`: linefeed LF | `\n` | `\u000a` | linefeed | LF |
`\f` `\u000c`: form feed FF | `\f` | `\u000c` | form feed | FF |
`\r` `\u000d`: carriage return CR | `\r` | `\u000d` | carriage return | CR |
`\"` `\u0022`: double quote " | `\"` | `\u0022` | double quote | " |
`\'` `\u0027`: single quote ' | `\'` | `\u0027` | single quote | ' |
`\\` `\u005c`: backslash `\` | `\\` | `\u005c` | backslash | `\` |
------ -------------------------------


A character with Unicode between 0 and 255 may also be represented by A character with Unicode between 0 and 255 may also be represented by
an octal escape, i.e. a backslash ‘\’ followed by a an octal escape, i.e. a backslash ‘\’ followed by a
Expand Down
3 changes: 2 additions & 1 deletion 05-types.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -149,12 +149,13 @@ Some type designators and their expansions are listed below. We assume
a local type parameter $t$, a value `maintable` a local type parameter $t$, a value `maintable`
with a type member `Node` and the standard class `scala.Int`, with a type member `Node` and the standard class `scala.Int`,


| | |
|-------------------- | --------------------------| |-------------------- | --------------------------|
|t | ε.type#t | |t | ε.type#t |
|Int | scala.type#Int | |Int | scala.type#Int |
|scala.Int | scala.type#Int | |scala.Int | scala.type#Int |
|data.maintable.Node | data.maintable.type#Node | |data.maintable.Node | data.maintable.type#Node |
|-------------------- | --------------------------|




### Parameterized Types ### Parameterized Types
Expand Down
5 changes: 3 additions & 2 deletions 08-expressions.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -438,12 +438,13 @@ parameterlist `()`.
The method values in the left column are each equivalent to the The method values in the left column are each equivalent to the
[anonymous functions](#anonymous-functions) on their right. [anonymous functions](#anonymous-functions) on their right.


| | |
|------------------------------ | --------------------------------------------| |------------------------------ | --------------------------------------------|
|`Math.sin _` | `x => Math.sin(x)` | |`Math.sin _` | `x => Math.sin(x)` |
|`Array.range _` | `(x1, x2) => Array.range(x1, x2)` | |`Array.range _` | `(x1, x2) => Array.range(x1, x2)` |
|`List.map2 _` | `(x1, x2) => (x3) => List.map2(x1, x2)(x3)` | |`List.map2 _` | `(x1, x2) => (x3) => List.map2(x1, x2)(x3)` |
|`List.map2(xs, ys)_` | `x => List.map2(xs, ys)(x)` | |`List.map2(xs, ys)_` | `x => List.map2(xs, ys)(x)` |
|------------------------------ | --------------------------------------------|


Note that a space is necessary between a method name and the trailing underscore 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. because otherwise the underscore would be considered part of the name.
Expand Down Expand Up @@ -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 The anonymous functions in the left column use placeholder
syntax. Each of these is equivalent to the anonymous function on its right. syntax. Each of these is equivalent to the anonymous function on its right.


| | |
|---------------------------|----------------------------| |---------------------------|----------------------------|
|`_ + 1` | `x => x + 1` | |`_ + 1` | `x => x + 1` |
|`_ * _` | `(x1, x2) => x1 * x2` | |`_ * _` | `(x1, x2) => x1 * x2` |
|`(_: Int) * 2` | `(x: Int) => (x: Int) * 2` | |`(_: Int) * 2` | `(x: Int) => (x: Int) * 2` |
|`if (_) x else y` | `z => if (z) x else y` | |`if (_) x else y` | `z => if (z) x else y` |
|`_.map(f)` | `x => x.map(f)` | |`_.map(f)` | `x => x.map(f)` |
|`_.map(_ + 1)` | `x => x.map(y => y + 1)` | |`_.map(_ + 1)` | `x => x.map(y => y + 1)` |
|---------------------------|----------------------------|




## Constant Expressions ## Constant Expressions
Expand Down
2 changes: 1 addition & 1 deletion 14-the-scala-standard-library.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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 we have the following correspondences between Scala and Java/C# code for
operations on an array `xs`: operations on an array `xs`:


| | |
|------------------|------------| |------------------|------------|
|_Scala_ |_Java/C#_ | |_Scala_ |_Java/C#_ |
|`xs.length` |`xs.length` | |`xs.length` |`xs.length` |
|`xs(i)` |`xs[i]` | |`xs(i)` |`xs[i]` |
|`xs(i) = e` |`xs[i] = e` | |`xs(i) = e` |`xs[i] = e` |
|------------------|------------|


Two implicit conversions exist in `Predef` that are frequently applied to arrays: Two implicit conversions exist in `Predef` that are frequently applied to arrays:
a conversion to `scala.collection.mutable.ArrayOps` and a conversion to a conversion to `scala.collection.mutable.ArrayOps` and a conversion to
Expand Down

0 comments on commit 507e58b

Please sign in to comment.