-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b5b777
commit dff10a9
Showing
8 changed files
with
188 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Help | ||
|
||
## Running the tests | ||
|
||
To compile and run the tests, just run the following in your exercise directory: | ||
|
||
```shell | ||
nim r test_exercise_name.nim | ||
``` | ||
|
||
Replace `exercise_name` with the name of the exercise (e.g. `all_your_base`). | ||
|
||
## Submitting your solution | ||
|
||
You can submit your solution using the `exercism submit hello_world.nim` command. | ||
This command will upload your solution to the Exercism website and print the solution page's URL. | ||
|
||
It's possible to submit an incomplete solution which allows you to: | ||
|
||
- See how others have completed the exercise | ||
- Request help from a mentor | ||
|
||
## Need to get help? | ||
|
||
If you'd like help solving the exercise, check the following pages: | ||
|
||
- The [Nim track's documentation](https://exercism.org/docs/tracks/nim) | ||
- [Exercism's programming category on the forum](https://forum.exercism.org/c/programming/5) | ||
- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs) | ||
|
||
Should those resources not suffice, you could submit your (incomplete) solution to request mentoring. | ||
|
||
Need help? These guides should help you: | ||
|
||
- [Installing Nim](https://exercism.org/tracks/nim/installation) | ||
- [Running the Tests](https://exercism.org/tracks/nim/tests) | ||
- [Learning Nim](https://exercism.org/tracks/nim/learning) | ||
- [Useful Nim Resources](https://exercism.org/tracks/nim/resources) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Hello World | ||
|
||
Welcome to Hello World on Exercism's Nim Track. | ||
If you need help running the tests or submitting your code, check out `HELP.md`. | ||
|
||
## Instructions | ||
|
||
The classical introductory exercise. | ||
Just say "Hello, World!". | ||
|
||
["Hello, World!"][hello-world] is the traditional first program for beginning programming in a new language or environment. | ||
|
||
The objectives are simple: | ||
|
||
- Modify the provided code so that it produces the string "Hello, World!". | ||
- Run the test suite and make sure that it succeeds. | ||
- Submit your solution and check it at the website. | ||
|
||
If everything goes well, you will be ready to fetch your first real exercise. | ||
|
||
[hello-world]: https://en.wikipedia.org/wiki/%22Hello,_world!%22_program | ||
|
||
## Source | ||
|
||
### Created by | ||
|
||
- @cmc333333 | ||
|
||
### Contributed to by | ||
|
||
- @ee7 | ||
|
||
### Based on | ||
|
||
This is an exercise to introduce users to using Exercism - https://en.wikipedia.org/wiki/%22Hello,_world!%22_program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
proc hello*: string = | ||
"Hello, World!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import unittest | ||
import hello_world | ||
|
||
suite "Hello World": | ||
test "say hi!": | ||
check hello() == "Hello, World!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Help | ||
|
||
## Running the tests | ||
|
||
To compile and run the tests, just run the following in your exercise directory: | ||
|
||
```shell | ||
nim r test_exercise_name.nim | ||
``` | ||
|
||
Replace `exercise_name` with the name of the exercise (e.g. `all_your_base`). | ||
|
||
## Submitting your solution | ||
|
||
You can submit your solution using the `exercism submit two_fer.nim` command. | ||
This command will upload your solution to the Exercism website and print the solution page's URL. | ||
|
||
It's possible to submit an incomplete solution which allows you to: | ||
|
||
- See how others have completed the exercise | ||
- Request help from a mentor | ||
|
||
## Need to get help? | ||
|
||
If you'd like help solving the exercise, check the following pages: | ||
|
||
- The [Nim track's documentation](https://exercism.org/docs/tracks/nim) | ||
- [Exercism's programming category on the forum](https://forum.exercism.org/c/programming/5) | ||
- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs) | ||
|
||
Should those resources not suffice, you could submit your (incomplete) solution to request mentoring. | ||
|
||
Need help? These guides should help you: | ||
|
||
- [Installing Nim](https://exercism.org/tracks/nim/installation) | ||
- [Running the Tests](https://exercism.org/tracks/nim/tests) | ||
- [Learning Nim](https://exercism.org/tracks/nim/learning) | ||
- [Useful Nim Resources](https://exercism.org/tracks/nim/resources) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Two Fer | ||
|
||
Welcome to Two Fer on Exercism's Nim Track. | ||
If you need help running the tests or submitting your code, check out `HELP.md`. | ||
|
||
## Introduction | ||
|
||
In some English accents, when you say "two for" quickly, it sounds like "two fer". | ||
Two-for-one is a way of saying that if you buy one, you also get one for free. | ||
So the phrase "two-fer" often implies a two-for-one offer. | ||
|
||
Imagine a bakery that has a holiday offer where you can buy two cookies for the price of one ("two-fer one!"). | ||
You go for the offer and (very generously) decide to give the extra cookie to a friend. | ||
|
||
## Instructions | ||
|
||
Your task is to determine what you will say as you give away the extra cookie. | ||
|
||
If your friend likes cookies, and is named Do-yun, then you will say: | ||
|
||
```text | ||
One for Do-yun, one for me. | ||
``` | ||
|
||
If your friend doesn't like cookies, you give the cookie to the next person in line at the bakery. | ||
Since you don't know their name, you will say _you_ instead. | ||
|
||
```text | ||
One for you, one for me. | ||
``` | ||
|
||
Here are some examples: | ||
|
||
| Name | Dialogue | | ||
| :----- | :-------------------------- | | ||
| Alice | One for Alice, one for me. | | ||
| Bohdan | One for Bohdan, one for me. | | ||
| | One for you, one for me. | | ||
| Zaphod | One for Zaphod, one for me. | | ||
|
||
## Source | ||
|
||
### Created by | ||
|
||
- @amscotti | ||
|
||
### Contributed to by | ||
|
||
- @ee7 | ||
|
||
### Based on | ||
|
||
https://github.com/exercism/problem-specifications/issues/757 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import unittest | ||
import two_fer | ||
|
||
suite "Two Fer": | ||
test "no name given": | ||
check twoFer() == "One for you, one for me." | ||
|
||
test "a name given": | ||
let name = "Alice" | ||
check twoFer(name) == "One for Alice, one for me." | ||
|
||
test "another name given": | ||
let name = "Bob" | ||
check twoFer(name) == "One for Bob, one for me." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
proc twoFer*(name = "you"): string = | ||
"One for " & name & ", one for me." |