From 39cc89a10b00ec1e818efdf77565f42b39a782ab Mon Sep 17 00:00:00 2001 From: Sahil Mahapatra Date: Sat, 16 Dec 2023 11:35:00 +0530 Subject: [PATCH] added roc formatting and replaced the img link with an svg --- crates/compiler/builtins/roc/Bool.roc | 2 +- www/content/faq.md | 42 ++++++++++++++------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/crates/compiler/builtins/roc/Bool.roc b/crates/compiler/builtins/roc/Bool.roc index 9e0b4173f1..c6d331a915 100644 --- a/crates/compiler/builtins/roc/Bool.roc +++ b/crates/compiler/builtins/roc/Bool.roc @@ -6,7 +6,7 @@ interface Bool ## ## Total equality means that all values of the type can be compared to each ## other, and two values `a`, `b` are identical if and only if `isEq a b` is -## `Bool.true`.test +## `Bool.true`. ## ## Not all types support total equality. For example, [`F32`](../Num#F32) and [`F64`](../Num#F64) can ## be a `NaN` ([Not a Number](https://en.wikipedia.org/wiki/NaN)), and the diff --git a/www/content/faq.md b/www/content/faq.md index 4304aadf39..1fa5bdac9a 100644 --- a/www/content/faq.md +++ b/www/content/faq.md @@ -1,12 +1,16 @@ -# faq +# Frequently Asked Questions ## Where did the name Roc come from? -The Roc logo, an origami bird - The Roc programming language is named after [a mythical bird](). -That’s why the logo is a bird. It’s specifically an [_origami_ bird](https://youtu.be/9gni1t1k1uY) as an homage + + + + + + +That's why the logo is a bird. It’s specifically an [_origami_ bird](https://youtu.be/9gni1t1k1uY) as an homage to [Elm](https://elm-lang.org/)’s tangram logo. Roc is a direct descendant of Elm. The languages are similar, but not the same. @@ -53,8 +57,10 @@ Both of these would make revising code riskier across the entire language, which Another option would be to define that function equality always returns `false`. So both of these would evaluate to `false`: -- `(\x -> x + 1) == (\x -> 1 + x)` -- `(\x -> x + 1) == (\x -> x + 1)` +```roc +(\x -> x + 1) == (\x -> 1 + x) #false +(\x -> x + 1) == (\x -> x + 1) #false +``` This makes function equality effectively useless, while still technically allowing it. It has some other downsides: @@ -250,11 +256,11 @@ the downsides. In Roc, both of these expressions evaluate to `"Hello, World!"` -```elixir +```roc Str.concat "Hello, " "World!" ``` -```elixir +```roc "Hello, " |> Str.concat "World!" ``` @@ -271,12 +277,12 @@ In Roc, both expressions evaluate to the same thing because Roc's `|>` operator This comes up in other situations besides string concatenation. For example, consider subtraction and division: -```elixir +```roc someNumber |> Num.div 2 ``` -```elixir +```roc someNumber |> Num.sub 1 ``` @@ -290,7 +296,7 @@ experienced users. The way `|>` works in Roc has a second benefit when it comes to higher-order functions. Consider these two examples: -```elixir +```roc answer = List.map numbers \num -> someFunction "some argument" @@ -298,7 +304,7 @@ answer = List.map numbers \num -> anotherArg ``` -```elixir +```roc numbers |> List.map Num.abs ``` @@ -309,7 +315,7 @@ In a curried language, these two examples couldn't both be valid. In order for ` This means the first example would have to change from this... -```elixir +```roc answer = List.map numbers \num -> someFunction "some argument" @@ -319,7 +325,7 @@ answer = List.map numbers \num -> ...to this: -```elixir +```roc answer = List.map (\num -> @@ -368,7 +374,7 @@ And however easy Roc would be to learn if it had currying, the language is certa a new function by composing together two existing functions without naming intermediate arguments. Here's an example: -```elm +```roc reverseSort : List elem -> List elem reverseSort = compose List.reverse List.sort @@ -378,7 +384,7 @@ compose = \f, g, x -> f (g x) Here's a way to write it without pointfree function composition: -```elm +```roc reverseSort : List elem -> List elem reverseSort = \list -> List.reverse (List.sort list) ``` @@ -441,7 +447,3 @@ There were a few reasons for this rewrite. 4. Zig has more tools for working in a memory-unsafe environment, such as reporting memory leaks in tests. These have been helpful in finding bugs that are out of scope for safe Rust. The split of Rust for the compiler and Zig for the standard library has worked well so far, and there are no plans to change it. - -## Why is the website so basic? - -We have a very basic website on purpose, it helps set expectations that roc is a work in progress and not ready yet for a first release.