Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
denismerigoux committed Jan 29, 2025
1 parent ee54ba2 commit c82a816
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions src/2-1-basic-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ of specification into the Catala program amounts to copy-pasting the
text and formatting it in Markdown syntax inside the source code file.

Without further ado, let us introduce the first bit of specification for
our fictional income tax, Article 1 of the CTTC (Catala Tutorial Tax Code):
our fictional income tax, article 1 of the CTTC (Catala Tutorial Tax Code):

```admonish quote title="Article 1"
The income tax for an individual is defined as a fixed percentage of the
Expand All @@ -42,8 +42,8 @@ individual's income over a year.

The spirit of writing code in Catala is to stick to the specification at all
times in order to put the code snippets where they belong. Hence, we will
introduce below the Catala code snippets that translate Article 1, which
should be put just below Article 1 in the Catala source code file.
introduce below the Catala code snippets that translate article 1, which
should be put just below article 1 in the Catala source code file.

These code
snippets should describe the program that computes the income tax, and contain
Expand All @@ -53,7 +53,7 @@ to dive into Catala as a programming language.

```catala
# We will soon learn what to write here in order to translate the meaning
# of Article 1 into Catala code.
# of article 1 into Catala code.
# To create a block of Catala code in your file, bound it with Markdown-style
# "```catala" and "```" delimiters. You can write comments in Catala code blocks
Expand All @@ -63,7 +63,7 @@ to dive into Catala as a programming language.
## Setting up data structures


The content of Article 1 assumes a lot of implicit context: there exists an
The content of article 1 assumes a lot of implicit context: there exists an
individual with an income, as well as an income tax that the individual has
to pay each year. Even if this implicit context is not verbatim in the law,
we have to explicit it in the computer code, in the form of data structures
Expand Down Expand Up @@ -143,7 +143,7 @@ Catala is called a *scope*. A scope is comprised of :
* internal variables (similar to local variables),
* output variables (that together form the return type of the function).

For instance, Article 1 declares a scope for computing the income tax:
For instance, article 1 declares a scope for computing the income tax:

~~~admonish note title="Declaring a scope"
```catala
Expand Down Expand Up @@ -176,7 +176,7 @@ Note that a variable can also be simultaneously an input and an output of the
scope, in that case it should be annotated with `input output`.

Once the scope has been declared, we can use it to define our computation
rules and finally code up Article 1!
rules and finally code up article 1!


## Defining variables and formulas
Expand Down
14 changes: 7 additions & 7 deletions src/2-2-conditionals-exceptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Specifications coming from legal text do not always
neatly divide up each variable definition into its own article. Sometimes, and this
is a very common pattern, a later article redefines a variable already
defined previously, but with a twist in a certain exceptional situation.
For instance, Article 3 of CTTC:
For instance, article 3 of CTTC:

~~~admonish quote title="Article 3"
If the individual is in charge of 2 or more children, then the fixed
Expand Down Expand Up @@ -82,7 +82,7 @@ times. Here, however, our definition of `tax_rate` conflicts with the
more general definition that we gave above. To correctly model situations like
this, Catala allows us to define precedence of one conditional definitions
over another. It is as simple as adding `exception` before the definition.
For instance, here is a more correct version of the code for Article 3:
For instance, here is a more correct version of the code for article 3:

~~~admonish quote title="Article 3"
If the individual is in charge of 2 or more children, then the fixed
Expand All @@ -98,8 +98,8 @@ scope IncomeTaxComputation:
```
~~~

With `exception`, the conditional definition at Article 3 will be picked over
the base case at Article 1 when the individual has two children or more. This
With `exception`, the conditional definition at article 3 will be picked over
the base case at article 1 when the individual has two children or more. This
`exception` mechanism is modeled on the logic of legal drafting: it is the key
mechanism that lets us split our variables definition to match the structure of
the specification. Without `exception`, it is not possible to use the literate
Expand Down Expand Up @@ -129,8 +129,8 @@ As described above, putting `exception` in a Catala program alters the behavior
of the program, by providing a priority between conditional definitions of a
variable that Catala can use at execution time when hesitating between multiple
definitions that apply at the same time. So far, we have seen a very simple
situation with one base definition (in Article 2) and a single exception (in
Article 3). But the `exception` mechanism can be much broader and help set
situation with one base definition (in article 2) and a single exception (in
article 3). But the `exception` mechanism can be much broader and help set
different priority lines among dozens of different conditional definitions for a
same variable. Let us explore this mechanism on a more complex example.

Expand Down Expand Up @@ -203,7 +203,7 @@ the taxpayer to pay $0 in tax rather than 15 % of their income, we can make the
legal decision to prioritize the exception of article 4 over the exception of
article 3. Now, let us see how to write that with Catala. Because article 2 is
the base case for the exception of article 3, and article 3 is the base case for
the exception of Article 4, we need to give the definitions of `tax_rate` at
the exception of article 4, we need to give the definitions of `tax_rate` at
articles 2 and 3 an explicit `label` so that the `exception` keywords in article
3 and 4 can refer to those labels:

Expand Down
2 changes: 1 addition & 1 deletion theme/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -3840,7 +3840,7 @@ if (typeof exports === 'object' && typeof module !== 'undefined') { module.expor
keyword: ['match', 'with', 'pattern', 'but', 'replace', 'we', 'have',
'let', 'in', 'such', 'that', 'exists', 'among', 'for', 'all',
'of', 'if', 'then', 'else', 'initial',
'scope', 'depends on', 'result', 'declaration', 'includes',
'scope', 'depends', 'on', 'result', 'declaration', 'includes',
'content', 'optional', 'structure', 'enumeration',
'context', 'input', 'output', 'internal', 'rule',
'under', 'condition', 'data', 'consequence',
Expand Down

0 comments on commit c82a816

Please sign in to comment.