Skip to content

Commit

Permalink
Merge pull request #5946 from lukewilliamboswell/website-update
Browse files Browse the repository at this point in the history
Website updates
  • Loading branch information
Anton-4 committed Nov 1, 2023
2 parents 849296a + ace59a3 commit 079421c
Show file tree
Hide file tree
Showing 6 changed files with 2,000 additions and 41 deletions.
2 changes: 1 addition & 1 deletion www/wip_new_website/content/friendly.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ If you like, you can run a program that has compile-time errors like this. (If t

You can run `roc test` to run all your tests. Each test is declared with the `expect` keyword, and can be as short as one line. For example, this is a complete test:

```
```roc
## One plus one should equal two.
expect 1 + 1 == 2
```
Expand Down
30 changes: 15 additions & 15 deletions www/wip_new_website/content/functional.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Roc is designed to have a small number of simple language primitives. This goal

All Roc values are semantically immutable, but may be opportunistically mutated behind the scenes when it would improve performance (without affecting the program's behavior). For example:

```elm
```roc
colors
|> Set.insert "Purple"
|> Set.insert "Orange"
Expand All @@ -29,7 +29,7 @@ An ergonomics benefit of having no direct mutation primitives is that functions

This makes Roc functions naturally amenable to pipelining, as we saw in the earlier example:

```elm
```roc
colors
|> Set.insert "Purple"
|> Set.insert "Orange"
Expand All @@ -53,41 +53,41 @@ In Roc, this will give a compile-time error. Once a name has been assigned to a

A benefit of this design is that it makes Roc code easier to rearrange without causing regressions. Consider this code:

```elm
```roc
func = \arg ->
greeting = "Hello"
welcome = \name -> "\(greeting), \(name)!"
#
message = welcome "friend"
#
```

Suppose I decide to extract the `welcome` function to the top level, so I can reuse it elsewhere:

```elm
```roc
func = \arg ->
#
message = welcome "Hello" "friend"
#
welcome = \prefix, name -> "\(prefix), \(name)!"
```

Without knowing the rest of `func`, we can be confident this change will not alter the code's behavior. In contrast, suppose Roc allowed reassignment. Then it's possible something in the `` parts of the code could have modified `greeting` before it was used in the `message =` declaration. For example:
Without knowing the rest of `func`, we can be confident this change will not alter the code's behavior. In contrast, suppose Roc allowed reassignment. Then it's possible something in the `# ` parts of the code could have modified `greeting` before it was used in the `message =` declaration. For example:

```elm
```roc
func = \arg ->
greeting = "Hello"
welcome = \name -> "\(greeting), \(name)!"
#
if someCondition then
greeting = "Hi"
#
else
#
#
message = welcome "friend"
#
```

In this example, if we didn't read the whole function to see that `greeting` was later sometimes (but not always) changed from `"Hello"` to `"Hi"`, we might not have realized that changing it to `message = welcome "Hello" "friend"` would cause a regression due to having the greeting always be `"Hello"`. Because Roc disallows reassignment, this particular regression can't happen, and so the code can be confidently rearranged without checking the rest of the function.
Expand Down
14 changes: 7 additions & 7 deletions www/wip_new_website/content/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@
<section class="home-goals-container">
<div class="home-goals-column">
<div class="home-goals-content">
<h3 class="home-goals-title"><a href="/fast">Fast</a></h3>
<h3 class="home-goals-title"><a href="/wip/fast.html">Fast</a></h3>
<p class="home-goals-description">Roc code is designed to build fast and run fast. <span class="nobreak-on-mobile">It compiles to machine code or WebAssembly.</span></p>
<p class="home-goals-learn-more"><a href="/fast">What does <i>fast</i> mean here?</a></p>
<p class="home-goals-learn-more"><a href="/wip/fast.html">What does <i>fast</i> mean here?</a></p>
</div>
</div>
<div class="home-goals-column">
<div class="home-goals-content">
<h3 class="home-goals-title"><a href="/friendly">Friendly</a></h3>
<h3 class="home-goals-title"><a href="/wip/friendly.html">Friendly</a></h3>
<p class="home-goals-description">Roc’s syntax, semantics, and included toolset <span class="nobreak-on-mobile">all prioritize user-friendliness.</span></p>
<p class="home-goals-learn-more"><a href="/friendly">What does <i>friendly</i> mean here?</a></p>
<p class="home-goals-learn-more"><a href="/wip/friendly.html">What does <i>friendly</i> mean here?</a></p>
</div>
</div>
<div class="home-goals-column">
<div class="home-goals-content">
<h3 class="home-goals-title"><a href="/functional">Functional</a></h3>
<h3 class="home-goals-title"><a href="/wip/functional.html">Functional</a></h3>
<p class="home-goals-description">
Roc has a small number of simple language primitives. <span class="nobreak-on-mobile">It’s a single-paradigm functional language.</span></p>
<p class="home-goals-learn-more"><a href="/design_goals.html#functional">What does <i>functional</i> mean here?</a></p>
<p class="home-goals-learn-more"><a href="/wip/functional.html">What does <i>functional</i> mean here?</a></p>
</div>
</div>
</section>
Expand All @@ -60,7 +60,7 @@
<div id="repl" role="presentation">
<code class="history">
<div id="help-text"></div>
<div id="history-text"><div id="loading-message">Loading REPL WebAssembly moduleplease wait!</div></div>
<div id="history-text"><div id="loading-message">Loading REPL WebAssembly module...please wait!</div></div>
</code>
<section id="source-input-wrapper">
<textarea rows="5" id="source-input" placeholder="You can enter Roc code here once the REPL loads!"
Expand Down
Loading

0 comments on commit 079421c

Please sign in to comment.