Skip to content

Commit

Permalink
docs: intro/first-program: Fix the branches; promote a par. (SQUASH ^…
Browse files Browse the repository at this point in the history
…{23})
  • Loading branch information
jashank committed Apr 30, 2020
1 parent b73d780 commit 5233f89
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions docs/introduction/first-program.rst
Original file line number Diff line number Diff line change
Expand Up @@ -318,19 +318,15 @@ and give the expression to resolve to::
add (x, y)
= let sum = x + y
in sum < x || sum < y
| True -> Success sum
| False -> Error ()
| True -> Error ()
| False -> Success sum

For our ``R`` type, we can do something similar.
Here's a contrived example using it::

fn _ = add (7, 6)
| Success x -> x
| Error y -> 42


Gum, Glue, and Antiquoted C
======================================================
fn () = add (7, 6)
| Success x -> x
| Error y -> 42

That's pretty much all that we can do in |cogent|.
We can save our favourite definition of ``add``,
Expand All @@ -342,6 +338,11 @@ you can read :doc:`../reference/surface-syntax`.

.. todo:: Part of the language reference will become a section in this doc later.



Gum, Glue, and Antiquoted C
======================================================

Next we will have to write the C code,
which does the things that |cogent| cannot do.
|cogent| code will be compiled to C code,
Expand Down

0 comments on commit 5233f89

Please sign in to comment.