Skip to content

Commit

Permalink
Content tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
oubiwann committed Nov 23, 2023
1 parent f9bce4b commit 180b785
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
6 changes: 2 additions & 4 deletions src/part1/intro/hw/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# 'Hello, World!'

Hello-World style introductory programs are intended to give the potential programmer for that language a sense of what it is like to write a minimalist piece of software with the language in question. In particular, it should show off the minimum capabilitiues of the language, essentially, what you could be in for should you decide upon this path.
Hello-World style introductory programs are intended to give the prospective programmer for that language a sense of what it is like to write a minimalist piece of software with the language in question. In particular, it should show off the minimum capabilitiues of the language. Practically, this type of program should sigify to the curious coder what they could be in for, should they decide upon this particular path.

In the case of LFE/OTP, this is extremely misleading. But more on that in the OTP version of the Hello-World program.

In this section we will concede to conventional practice and produce a minimal Hello-World that does what many other languages' Hello-World programs do.
In the case of LFE/OTP, a standard Hello-World program (essentially a "print" statement) is extremely misleading; more on that in the OTP version of the Hello-World program. Regardless, we concede to conventional practice and produce a minimal Hello-World that does what many other languages' Hello-World programs do. We do, however, go further afterwards ...
2 changes: 1 addition & 1 deletion src/part1/intro/hw/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ We have to provide the two dashes to let `rebar3` know that we're done with it,

As for the code itself, it's tiny. But there is a lot going on just with these two files. Have no fear, though: the remainder of this book will explore all of that and more. For now, know that the main function in the executable is calling the `hello-world` module's `my-fun` function, which takes no arguments. To put another way, what we really have here is a tiny, trivial library project with the addition of a script that calls a function from that library.

For now just know that an executable file which starts with `#!/usr/bin/env lfescript` and contains a `main` function accepting one argument is an LFE script capable of being executed from the command line -- a we have shown!
For now just know that an executable file which starts with `#!/usr/bin/env lfescript` and contains a `main` function accepting one argument is an LFE script capable of being executed from the command line -- as we have shown!
6 changes: 3 additions & 3 deletions src/part1/intro/hw/otp.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# LFE/OTP 'Hello, World!'

What have been demonstrated so far are fairly vanilla Hello-World examples; there's nothing particularly interesting about them, which puts them solidly iin the company of the millions of other Hello-World programs. As mentioned before, this approach is particularly vexing in the case of LFE/OTP, since it lures the prospective developer into the preconception that BEAM languages are just like other programming languages. They most decidfedluy are not.
What have been demonstrated so far are fairly vanilla Hello-World examples; there's nothing particularly interesting about them, which puts them solidly iin the company of the millions of other Hello-World programs. As mentioned before, this approach is particularly vexing in the case of LFE/OTP, since it lures the prospective developer into the preconception that BEAM languages are just like other programming languages. They most decidedly are not.

What makes them, and in this particular case LFE, special is OTP. There's really nothing quite like it, certainly not baked into the heart and soul of another programming language. Most useful applications you will write in LFE/OTP will be composed of some sort of long-running service or server, something that manages that server and restarts it in the event of errors, and lastly, a context that contains both, the latter usually referred to as the "application" itself.
What makes them, and in this particular case LFE, special is OTP. There's nothing quite like it, certainly not another language with OTP's feature set baked into its heart and soul. Most useful applications you will write in LFE/OTP will be composed of some sort of long-running service or server, something that manages that server and restarts it in the event of errors, and lastly, a context that contains both -- usually referred to as the "application" itself.

As such, a _real_ Hello-World in LFE would be honest and let the prospective developer know what they are in for (and what power will be placed at their fingertips). _That_ is what we will show now, a _real_ LFE Hello-World example.
As such, a _real_ Hello-World in LFE would be honest and let the prospective developer know what they are in for (and what power will be placed at their fingertips). _That_ is what we will show now, an LFE OTP Hello-World example.

If you are still in the directory of the previous Hello-World project, let's get out of that:

Expand Down
12 changes: 11 additions & 1 deletion src/part1/intro/hw/repl.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,17 @@ lfe> (hello-world)
;; ok
```

When we execute our `hello-world` function, it prints our message to `standard-output` and then lets us know everything really quite fine with a friendly `ok`. LFE displays `ok` as output for functions that do not return a value.
When we execute our `hello-world` function, it prints our message to `standard-output` and then lets us know everything really quite fine with a friendly `ok`.

<div class="alert alert-info">
<h4 class="alert-heading">
<i class="fa fa-info-circle" aria-hidden="true"></i>
Note
</h4>
<p class="mb-0">
LFE displays `ok` as output for functions that do not return a value.
</p>
</div>

Now let's address the other point: running a Hello-World programming from outside LFE.

Expand Down

0 comments on commit 180b785

Please sign in to comment.