Skip to content

Commit

Permalink
Tutorial on Mutability and Imperative Programming (#1529)
Browse files Browse the repository at this point in the history
* Tutorial on Mutability and Imperative Programming

Mutable Data: references, records and arrays/bytes
Imperative
Exceptions
Howto mix styles without getting into trouble
Refunctionalization techniques

* Remove french sentence

* Discussion with Sabine

* Intro, refs and mutable fields

* Text on arrays and bytes

* Add text on for and while loops

* Text on encapsulated mutability

* Update text

* Add tail recursion text

* Add CPS text

* More CPS text

* More CPS text, cont'd

* More CPS text

* More CPS text

* Effects order

* foo

* Add text on global state

* Remove stuff migrated to PR1770

* Add text on memoization

* dummy

* Add Anti-Patterns

* editing

* rename

* Review

* Rename if+loops+recursion into if+recursion

* Minor changes

* Use #show_type

* Minor fixes

* Include some feedback from @silene

See discuss thread: https://discuss.ocaml.org/t/draft-tutorial-on-mutability-loops-and-imperative-programming/13504/2

Only easy items, more to come

* Revert change creating conflict with PR1798

* Line editing & code check

* Review edits

* Address more review comments

* Fix typos

* minor grammar

* fix typo

* add "body expression"

* tighten syntax

* minor typo fixes

* Update 0it_06_imperative.md

* Review edits

---------

Co-authored-by: Cuihtlauac ALVARADO <[email protected]>
Co-authored-by: Sabine Schmaltz <[email protected]>
Co-authored-by: Christine Rose <[email protected]>
  • Loading branch information
4 people authored Dec 14, 2023
1 parent 76a81b1 commit e3c6fa8
Show file tree
Hide file tree
Showing 5 changed files with 678 additions and 5 deletions.
2 changes: 1 addition & 1 deletion data/tutorials/getting-started/1_01_a_tour_of_ocaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -750,5 +750,5 @@ Other recommended tutorials:

1. [Values and Functions](/docs/values-and-functions)
1. [Basic Data Types and Pattern Matching](/docs/basic-data-types)
1. [If Statements, Loops, and Recursions](/docs/if-statements-and-loops)
1. [If Statements and Recursions](/docs/if-statements-and-loops)
1. [Lists](/docs/lists)
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ This tutorial is the last of the "Getting Started" series. Moving forward, you h
Recommended next tutorials:
1. [Values and Functions](/docs/values-and-functions)
1. [Basic Data Types and Pattern Matching](/docs/basic-data-types)
1. [If Statements, Loops, and Recursions](/docs/if-statements-and-loops)
1. [If Statements and Recursions](/docs/if-statements-and-loops)
1. [Lists](/docs/lists)

<!--
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
id: if-statements-and-loops
title: If Statements, Loops, and Recursions
title: If Statements and Recursions
description: >
Learn basic control-flow and recursion in OCaml
category: "Introduction"
---

# If Statements, Loops, and Recursions
# If Statements and Recursions

As in other OCaml.org documentation, the code examples will either be something you can test or
an example of code. Code snippets that begin with the CLI prompt `#`, end with `;;`, and have a
Expand Down
2 changes: 1 addition & 1 deletion data/tutorials/language/0it_05_labels.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ example:
```

So far, this is just the imperative "mutable records" that we talked
about in ["If Statements, Loops, and Recursions"](https://ocaml.org/docs/if-statements-and-loops). Now the complex part is the `open_window`
about in ["If Statements and Recursions"](https://ocaml.org/docs/if-statements-and-loops). Now the complex part is the `open_window`
function. This function takes *4* arguments, three of them optional,
followed by a required, unlabelled `unit`. Let's first see this function
in action:
Expand Down
Loading

0 comments on commit e3c6fa8

Please sign in to comment.