Skip to content
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

Remove suggestions from Elixir's Lasagna #2273

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions tracks/elixir/exercises/lasagna/mentoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,3 @@ defmodule Lasagna do
def alarm, do: "Ding!"
end
```

## Common suggestions


If a solution uses names like `is_cooked` and `is_ready`,
it can be pointed out that Elixir has the following naming convention:
- `is_foo` should only be used for macros that can be used in guard clauses,
- `foo?` should be used otherwise.

Sources:
- https://github.com/rrrene/elixir-style-guide#predicates
- https://github.com/christopheradams/elixir_style_guide#predicate-macro-names-with-guards
- https://github.com/lexmag/elixir-style-guide#predicate-funs-name

### Usage of regular expressions

This exercise can be solved without regular expressions and a student could be encouraged to try to do that.
- Regular expressions are not known for their readability. `String.ends_with?(input, "?")` is more obvious than `Regex.match?(~r/\?$/, input)`.
- It is a good habit to use simple tools for simple problems and advanced tools for advanced problems.
- Elixir developers should be familiar with the `String` module and the functions it offers.

### Hint functions for the truly stuck

- [`String#trim/1`](https://hexdocs.pm/elixir/String.html#trim/1)
- [`String#ends_with?/2`](https://hexdocs.pm/elixir/String.html#ends_with?/2)
- [`String#downcase/2`](https://hexdocs.pm/elixir/String.html#downcase/2)
- [`String#upcase/2`](https://hexdocs.pm/elixir/String.html#upcase/2)
- `String.upcase(input) != String.downcase(input)` if there is a letter present.
Loading