-
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.
vimscript/reverse-string: download exercise
- Loading branch information
Showing
6 changed files
with
143 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,19 @@ | ||
{ | ||
"authors": [ | ||
"BNAndras" | ||
], | ||
"files": { | ||
"solution": [ | ||
"reverse_string.vim" | ||
], | ||
"test": [ | ||
"reverse_string.vader" | ||
], | ||
"example": [ | ||
".meta/example.vim" | ||
] | ||
}, | ||
"blurb": "Reverse a given string.", | ||
"source": "Introductory challenge to reverse an input string", | ||
"source_url": "https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb" | ||
} |
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 @@ | ||
{"track":"vimscript","exercise":"reverse-string","id":"f700f10d947c4dd6b81af8629b046dad","url":"https://exercism.org/tracks/vimscript/exercises/reverse-string","handle":"vpayno","is_requester":true,"auto_approve":false} |
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,52 @@ | ||
# Help | ||
|
||
## Running the tests | ||
|
||
Open your solution: | ||
|
||
```bash | ||
$ vim <exercise>.vim | ||
``` | ||
|
||
Source the current file to make its global functions available to Vim: | ||
|
||
``` | ||
:source % | ||
``` | ||
|
||
Run the tests: | ||
|
||
``` | ||
:Vader <exercise>.vader | ||
``` | ||
|
||
Replace `<exercise>` with your exercise's name. | ||
|
||
## Submitting your solution | ||
|
||
You can submit your solution using the `exercism submit reverse_string.vim` 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 [Vim script track's documentation](https://exercism.org/docs/tracks/vimscript) | ||
- The [Vim script track's programming category on the forum](https://forum.exercism.org/c/programming/vimscript) | ||
- [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. | ||
|
||
To get help if you're having trouble, you can use one of the following resources: | ||
|
||
- [Learn Vimscript the Hard Way](http://learnvimscriptthehardway.stevelosh.com) | ||
- [IBM DeveloperWorks: Scripting the Vim | ||
editor](http://www.ibm.com/developerworks/views/linux/libraryview.jsp?sort_order=asc&sort_by=Title&search_by=scripting+the+vim+editor) | ||
- [/r/vimscript](https://www.reddit.com/r/vimscript) is the Vimscript subreddit. | ||
- [StackOverflow](http://stackoverflow.com/) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions. |
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,30 @@ | ||
# Reverse String | ||
|
||
Welcome to Reverse String on Exercism's Vim script Track. | ||
If you need help running the tests or submitting your code, check out `HELP.md`. | ||
|
||
## Introduction | ||
|
||
Reversing strings (reading them from right to left, rather than from left to right) is a surprisingly common task in programming. | ||
|
||
For example, in bioinformatics, reversing the sequence of DNA or RNA strings is often important for various analyses, such as finding complementary strands or identifying palindromic sequences that have biological significance. | ||
|
||
## Instructions | ||
|
||
Your task is to reverse a given string. | ||
|
||
Some examples: | ||
|
||
- Turn `"stressed"` into `"desserts"`. | ||
- Turn `"strops"` into `"sports"`. | ||
- Turn `"racecar"` into `"racecar"`. | ||
|
||
## Source | ||
|
||
### Created by | ||
|
||
- @BNAndras | ||
|
||
### Based on | ||
|
||
Introductory challenge to reverse an input string - https://medium.freecodecamp.org/how-to-reverse-a-string-in-javascript-in-3-different-ways-75e4763c68cb |
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,30 @@ | ||
|
||
Execute (an empty string): | ||
let g:value = "" | ||
let g:expected = "" | ||
AssertEqual g:expected, Reverse(g:value) | ||
|
||
Execute (a word): | ||
let g:value = "robot" | ||
let g:expected = "tobor" | ||
AssertEqual g:expected, Reverse(g:value) | ||
|
||
Execute (a capitalized word): | ||
let g:value = "Ramen" | ||
let g:expected = "nemaR" | ||
AssertEqual g:expected, Reverse(g:value) | ||
|
||
Execute (a sentence with punctuation): | ||
let g:value = "I'm hungry!" | ||
let g:expected = "!yrgnuh m'I" | ||
AssertEqual g:expected, Reverse(g:value) | ||
|
||
Execute (a palindrome): | ||
let g:value = "racecar" | ||
let g:expected = "racecar" | ||
AssertEqual g:expected, Reverse(g:value) | ||
|
||
Execute (an even-sized word): | ||
let g:value = "drawer" | ||
let g:expected = "reward" | ||
AssertEqual g:expected, Reverse(g:value) |
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,11 @@ | ||
" | ||
" Reverses the passed test | ||
" | ||
" Examples: | ||
" | ||
" :echo Reverse('Exercism') | ||
" msicrexE | ||
" | ||
function! Reverse(text) abort | ||
" your code goes here | ||
endfunction |