Skip to content

Commit

Permalink
Remove trailing whitespace (ocaml#882)
Browse files Browse the repository at this point in the history
Co-authored-by: Cuihtlauac ALVARADO <cuihtmlauac@tarides.com>
  • Loading branch information
cuihtlauac and Cuihtlauac ALVARADO committed Feb 3, 2023
1 parent 57cedd3 commit c786a2a
Show file tree
Hide file tree
Showing 17 changed files with 190 additions and 190 deletions.
4 changes: 2 additions & 2 deletions data/tutorials/ds_00_lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ When using association lists, and for other purposes, it is sometimes useful to
be able to make a list of pairs from a pair of lists and vice versa. The
[`List`](https://ocaml.org/api/List.html) module provides the functions
[`split`](https://ocaml.org/api/List.html#VALsplit) and
[`combine`](https://ocaml.org/api/List.html#VALcombine) for this purpose:
[`combine`](https://ocaml.org/api/List.html#VALcombine) for this purpose:

```ocaml
# List.split [(3, "three"); (1, "one"); (4, "four")];;
Expand Down Expand Up @@ -372,7 +372,7 @@ is the type of each element of the list. The next argument is the initial
accumulator, which must be of type `'a`, and then finally the input list of
type `'b list`. The result is the final value of the accumulator, so it must
have type `'a`. Of course, in both of our examples, `'a` and `'b` are the same
as one another. But this is not always so.
as one another. But this is not always so.

Consider the following definition of `append` which uses
[`fold_right`](https://ocaml.org/api/List.html#VALfold_right)
Expand Down
2 changes: 1 addition & 1 deletion data/tutorials/ds_02_set.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ is in the set that we have created. To do this we can write a function
that will print the set out.

```ocaml
# let print_set s =
# let print_set s =
SS.iter print_endline s;;
val print_set : SS.t -> unit = <fun>
```
Expand Down
2 changes: 1 addition & 1 deletion data/tutorials/ds_03_hashtbl.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ sense. Instead, we would write something like this:
```

If we want to find one element in `my_hash` that has an `"h"` in it then we
would write:
would write:

```ocaml
# Hashtbl.find my_hash "h";;
Expand Down
14 changes: 7 additions & 7 deletions data/tutorials/gs_00_up_and_running.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ However, please note that it is still experimental and in active development

After having installed opam, you will need to initialise it, [see below](#initialising-opam-on-unix).

To install opam, you can [use your system package manager](https://opam.ocaml.org/doc/Install.html#Using-your-distribution-39-s-package-system) or download the [binary distribution](https://opam.ocaml.org/doc/Install.html#Binary-distribution). The details are available in the above links, but for convenience, we copy a few of them here:
To install opam, you can [use your system package manager](https://opam.ocaml.org/doc/Install.html#Using-your-distribution-39-s-package-system) or download the [binary distribution](https://opam.ocaml.org/doc/Install.html#Binary-distribution). The details are available in the above links, but for convenience, we copy a few of them here:

**For macOS**

If you're installing with [Homebrew](https://brew.sh/):
If you're installing with [Homebrew](https://brew.sh/):

```shell
# With Homebrew:
Expand Down Expand Up @@ -104,7 +104,7 @@ $ bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/s

#### Initialising opam on Unix

On Unix, it's essential to initialise opam, which will (if needed) install the OCaml compiler. If you already have OCaml installed, opam will use that compiler.
On Unix, it's essential to initialise opam, which will (if needed) install the OCaml compiler. If you already have OCaml installed, opam will use that compiler.

This step is done automatically by the Platform Installer, [see below](#up-and-running-with-the-platform-installer).

Expand All @@ -121,7 +121,7 @@ The second command (`eval $(opam env)`) modifies a few environment variables to

**Please note:** At the end of the `opam init`, you are asked if you want to add a hook to your shell to best integrate with your system. Indeed, in order for the shell to be aware of the tools available in the current opam switch, a few environment variables need to be modified. For instance, the `PATH` variable has to be expanded so that typing `ocaml` in the shell runs the OCaml binary _of the current switch_. Answering `y` will provide a better user experience.

Now check the installation by running `opam --version`. You can compare it with the current version on [opam.ocaml.org](https://opam.ocaml.org/).
Now check the installation by running `opam --version`. You can compare it with the current version on [opam.ocaml.org](https://opam.ocaml.org/).

#### Creating a New Switch on Unix

Expand Down Expand Up @@ -154,7 +154,7 @@ In this section, we'll describe using the new [Diskuv OCaml](https://github.com/
Before using the DKML installer, briefly review the following:

* You need to **stay at your computer** and press "Yes" for any Windows security popups.
* You need to **stay at your computer** and press "Yes" for any Windows security popups.
After the DKML installer finishes installing two programs (`Visual Studio Installer`
and `Git for Windows`), you can leave your computer for the remaining two (2) hours.

Expand Down Expand Up @@ -300,7 +300,7 @@ opam switch for example.

UTop is an extended and improved toplevel (REPL) for OCaml. Unlike the standard toplevel with the `ocaml` command, UTop features history, tab completion, interactive line editing, and the ability to load any package installed in your switch.

If you have never used a toplevel (REPL) before, think of it as an interactive terminal/shell that evaluates expressions. Type an OCaml expression, then press the Enter or Return key. The toplevel responds with the value of the evaluated expression.
If you have never used a toplevel (REPL) before, think of it as an interactive terminal/shell that evaluates expressions. Type an OCaml expression, then press the Enter or Return key. The toplevel responds with the value of the evaluated expression.

OCaml comes with two additional compilers: one compiles to **native code** (sometimes called machine code or executable binary), directly read by the CPU, and the other compiles to **bytecode**, creating an executable that can be interpreted by a variety of runtime environments, making more it flexible.

Expand Down Expand Up @@ -372,7 +372,7 @@ $ opam user-setup install
## Starting a New Project

We will set up a "Hello World" project using the build system Dune. Navigate
into a practice directory, as we'll be creating new projects below.
into a practice directory, as we'll be creating new projects below.

First, we initialise a new project using `dune` and then change into the
created directory. As usual, the line beneath the shell command is the expected
Expand Down
2 changes: 1 addition & 1 deletion data/tutorials/gs_01_a_first_hour_with_ocaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ val x : int = 50
```

Note that this isn't a variable as in languages like C and Python. Its value
cannot be changed.
cannot be changed.

We can write also write it all on one line using `let` ... `in` ...:

Expand Down
8 changes: 4 additions & 4 deletions data/tutorials/lg_00_data_types_and_matching.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ val is_primary : colour -> bool = <fun>

Each constructor in a data type can carry additional information with it. Let's
extend our `colour` type to allow arbitrary RGB triples, each element begin a
number from 0 (no colour) to 1 (full colour):
number from 0 (no colour) to 1 (full colour):

```ocaml env=colours
# type colour =
Expand Down Expand Up @@ -290,7 +290,7 @@ than a simple list of pairs. It is known as a *binary search tree*:
# let rec insert (k, v) = function
| Leaf -> Node (Leaf, (k, v), Leaf)
| Node (l, (k', v'), r) ->
if k < k' then Node (insert (k, v) l, (k', v'), r)
if k < k' then Node (insert (k, v) l, (k', v'), r)
else if k > k' then Node (l, (k', v'), insert (k, v) r)
else Node (l, (k, v), r);;
val insert : 'a * 'b -> ('a * 'b) tree -> ('a * 'b) tree = <fun>
Expand Down Expand Up @@ -601,8 +601,8 @@ val sum_t : t -> int = <fun>

## A Note on Tupled Constructors

There is a difference between `RGB of float * float * float` and
`RGB of (float * float * float)`.
There is a difference between `RGB of float * float * float` and
`RGB of (float * float * float)`.
The first is a constructor with three pieces of data
associated with it, the second is a constructor with one tuple associated with
it. There are two ways this matters: the memory layout differs between the two
Expand Down
24 changes: 12 additions & 12 deletions data/tutorials/lg_02_if_statements_loops_and_recursion.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ OCaml has an `if` statement with two variations, and the obvious meaning:
<!-- $MDX skip -->
```ocaml
if boolean-condition then expression
if boolean-condition then expression else other-expression
```

Expand Down Expand Up @@ -241,7 +241,7 @@ OCaml supports a rather limited form of the familiar `for` loop:
for variable = start_value to end_value do
expression
done
for variable = start_value downto end_value do
expression
done
Expand Down Expand Up @@ -513,17 +513,17 @@ line parameter.
```ocaml
(* Read whole file: Approach 1 *)
open Printf
let read_whole_chan chan =
let len = in_channel_length chan in
let result = (Bytes.create len) in
really_input chan result 0 len;
(Bytes.to_string result)
let read_whole_file filename =
let chan = open_in filename in
read_whole_chan chan
let main () =
let filename = Sys.argv.(1) in
let str = read_whole_file filename in
Expand All @@ -537,7 +537,7 @@ won't work on non-file channels like keyboard input or sockets. Approach
```ocaml
(* Read whole file: Approach 2 *)
open Printf
let read_whole_chan chan =
let buf = Buffer.create 4096 in
try
Expand All @@ -550,11 +550,11 @@ let read_whole_chan chan =
(always raises Assert_failure). *)
with
End_of_file -> Buffer.contents buf
let read_whole_file filename =
let chan = open_in filename in
read_whole_chan chan
let main () =
let filename = Sys.argv.(1) in
let str = read_whole_file filename in
Expand Down Expand Up @@ -587,7 +587,7 @@ Here's our recursive version. Notice that it's *shorter* than approach
```ocaml
(* Read whole file: Approach 3 *)
open Printf
let read_whole_chan chan =
let buf = Buffer.create 4096 in
let rec loop () =
Expand All @@ -598,11 +598,11 @@ let read_whole_chan chan =
in
try loop () with
End_of_file -> Buffer.contents buf
let read_whole_file filename =
let chan = open_in filename in
read_whole_chan chan
let main () =
let filename = Sys.argv.(1) in
let str = read_whole_file filename in
Expand Down Expand Up @@ -963,7 +963,7 @@ far":
```ocaml
let rec range2 a b accum =
(* ... *)
let range a b =
range2 a b []
```
Expand Down
6 changes: 3 additions & 3 deletions data/tutorials/lg_03_modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,12 @@ type. Let's do it in our `example.ml` file:
module Hello : sig
val hello : unit -> unit
end
=
=
struct
let message = "Hello"
let hello () = print_endline message
end
(* At this point, Hello.message is not accessible anymore. *)
let goodbye () = print_endline "Goodbye"
Expand All @@ -358,7 +358,7 @@ separately:
module type Hello_type = sig
val hello : unit -> unit
end
module Hello : Hello_type = struct
...
end
Expand Down
2 changes: 1 addition & 1 deletion data/tutorials/lg_08_error_handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ libraries provide useful combinators on the `result` type: `map`, `>>=`, etc.

## Assertions
The built-in `assert` takes an expression as an argument and throws an
exception *if* the provided expression evaluates to `false`.
exception *if* the provided expression evaluates to `false`.
Assuming that you don't catch this exception (it's probably
unwise to catch this exception, particularly for beginners), this
results in the program stopping and printing out the source file and
Expand Down

0 comments on commit c786a2a

Please sign in to comment.