From b3c11f661511a9a68ce00c6d27c57612f514fb67 Mon Sep 17 00:00:00 2001 From: loziniak Date: Thu, 23 Sep 2021 03:58:56 +0200 Subject: [PATCH] [WIP] --- README.md | 2 ++ concepts/basics/introduction.md | 16 ++++++++++++++++ concepts/conditionals/introduction.md | 9 +++++++++ concepts/dsl/introduction.md | 8 ++++++++ concepts/evaluation/introduction.md | 4 ++++ concepts/functions/about.md | 1 + 6 files changed, 40 insertions(+) diff --git a/README.md b/README.md index 64a2ef9..9aabdc7 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,8 @@ There is a tool, that counts and prints exercises unlocked by each concept, and `_tools/concepts-practice.red` +Recently, Exercism introduced tasks, which are just parts of an exercise. Currently, they are only possible in concept exercises. You can indicate, which tests are specific for particular task. Each track links tasks with tests [in a way maintainers find appropriate](https://github.com/exercism/docs/blob/main/building/tooling/test-runners/interface.md#task-id). In Red it is done by adding `" task_id: 1"` at the end of the test description string in exercise test file. Notice three spaces before "task_id". + ## Contact Besides creating issues and commenting in this repository, you are welcome to post on [Red's "training" Gitter channel](https://gitter.im/red/training). diff --git a/concepts/basics/introduction.md b/concepts/basics/introduction.md index e10b99d..712355e 100644 --- a/concepts/basics/introduction.md +++ b/concepts/basics/introduction.md @@ -1 +1,17 @@ # Introduction + +Everything you need to run Red programs and do exercises in Exercism: + +* Using editor +* Running your code +* Executing tests for exercises + +Red code is built from **blocks** and **values**. Block can contain values and other blocks. In fact, a block is also a value. + +Each value has its **type**. Block's type is `block!`. And type is also a value of type `type!`. There are lots of types in Red, like numbers, dates, tuples, urls, paths, strings, binary data, maps, vectors, emails... about a 50 of them. + +There are also **comments**. They start with `;` and end with end of line. Red has also block comments, but they are a different kind. In fact, they are accomplished with a function called `comment`, which takes any type of argument (can be block, string or anything) and just does absolutely nothing. + +Red is a homoiconic language, so it's code is actually just a data, until we **evaluate** a block. Which simply means, that we "execute" it and get value of last expression. + + diff --git a/concepts/conditionals/introduction.md b/concepts/conditionals/introduction.md index e10b99d..43f913d 100644 --- a/concepts/conditionals/introduction.md +++ b/concepts/conditionals/introduction.md @@ -1 +1,10 @@ # Introduction + +what's "truthy" + +* if +* unless +* either +* case + * default: `true` or word, like `'default` +* switch diff --git a/concepts/dsl/introduction.md b/concepts/dsl/introduction.md index 7caf14b..643af2a 100644 --- a/concepts/dsl/introduction.md +++ b/concepts/dsl/introduction.md @@ -1,3 +1,11 @@ # Introduction > Provide a brief introduction to a student who has not yet completed the corresponding concept exercise. + +There are various ways to implement a DSL: + +* define functions and run DSL as Red code +* parse DSL as Red blocks of data +* parse DSL strings + +... and any combinations of these methods. diff --git a/concepts/evaluation/introduction.md b/concepts/evaluation/introduction.md index e10b99d..e2290bc 100644 --- a/concepts/evaluation/introduction.md +++ b/concepts/evaluation/introduction.md @@ -1 +1,5 @@ # Introduction + +Precedence is left to right + +There is a fun part with comparison and math operators diff --git a/concepts/functions/about.md b/concepts/functions/about.md index f109e93..9c72283 100644 --- a/concepts/functions/about.md +++ b/concepts/functions/about.md @@ -4,3 +4,4 @@ TODO: * Most exercises here are written as functions, because they are reusable and easy to test, which makes them perfect for separating pieces of code. * Function names by convention should be verbs or contain verbs. +* In Red everything is a function, even expressions, that are keywords or operators in other languages, like `if` or `+`.