-
-
Notifications
You must be signed in to change notification settings - Fork 400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set up MarkdownCodeBlockFormatter #1419
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
[ | ||
inputs: ["mix.exs", "{exercises,bin}/**/*.{ex,exs}"] | ||
plugins: [MarkdownCodeBlockFormatter], | ||
inputs: ["mix.exs", "{exercises,bin}/**/*.{ex,exs}", "{concepts,exercises,docs,reference}/**/*.md", "*.md"] | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ Enum.reduce([4, 20, 31, 9, 2], nil, fn x, acc -> | |
x <= acc -> acc | ||
end | ||
end) | ||
|
||
# => 31 | ||
``` | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,11 +14,14 @@ Lists can be written in literal form, head-tail notation, (which uses the `cons` | |
|
||
# Head-tail Notation | ||
[] | ||
[1 | []] # same as [1] | ||
[1 | [2 | [3 | []]]] # same as [1, 2, 3] | ||
# same as [1] | ||
[1 | []] | ||
# same as [1, 2, 3] | ||
[1 | [2 | [3 | []]]] | ||
|
||
# Mixed | ||
[1 | [2, 3]] # same as [1, 2, 3] | ||
# same as [1, 2, 3] | ||
[1 | [2, 3]] | ||
``` | ||
|
||
There can also be more than one element before the _cons_ (`|`) operator. | ||
|
@@ -46,7 +49,8 @@ We can achieve the same result by prepending an element to the reversed list, an | |
[1, 2, 3] ++ [4] ++ [5] ++ [6] | ||
|
||
# Prepend to the start of a list (faster, due to the nature of linked lists) | ||
[6 | [5 | [4 | [3, 2, 1]]]] # then reverse! | ||
[6 | [5 | [4 | [3, 2, 1]]]] | ||
# then reverse! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did this comment go at the bottom? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I moved it manually because the "reverse" part is not part of this code. The code only shows list creation, and then it's implied that you need to reverse later. Hence the comment should be last. |
||
``` | ||
|
||
There are several common `Kernel` functions for lists: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,5 +18,6 @@ else | |
after | ||
:some_action | ||
end | ||
|
||
# => :success | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,5 +18,6 @@ else | |
after | ||
:some_action | ||
end | ||
|
||
# => :success | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where desired, formatting can be turned off. For example here we want to show off a non-standard way to format this code to prove a point.