Skip to content

Commit 6c21224

Browse files
authored
(WIP) hello-world and acronym exercises
2 parents 9feb14e + 68acd82 commit 6c21224

File tree

10 files changed

+122
-0
lines changed

10 files changed

+122
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Instructions
2+
3+
Convert a phrase to its acronym.
4+
5+
Techies love their TLA (Three Letter Acronyms)!
6+
7+
Help generate some jargon by writing a program that converts a long name like Portable Network Graphics to its acronym (PNG).
8+
9+
Punctuation is handled as follows: hyphens are word separators (like whitespace); all other punctuation can be removed from the input.
10+
11+
For example:
12+
13+
| Input | Output |
14+
| ------------------------- | ------ |
15+
| As Soon As Possible | ASAP |
16+
| Liquid-crystal display | LCD |
17+
| Thank George It's Friday! | TGIF |
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
{
3+
"authors": [
4+
"jonocarroll"
5+
],
6+
"contributors": [
7+
"rikedyp"
8+
],
9+
"files": {
10+
"solution": [
11+
"Acronym.aplf"
12+
],
13+
"test": [
14+
"Test_Acronym.aplf"
15+
],
16+
"example": [
17+
".meta/example.aplf"
18+
]
19+
},
20+
"blurb": "Convert a long phrase to its acronym."
21+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Acronym ← {⊃¨' '(≠⊆⊢)(' ',⎕A)∩⍨1⎕C('-'⎕R' ')⍵}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Acronym ← {⍵} ⍝ Implement the Acronym function
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
result←Test_Acronym;Assert
2+
3+
Assert←{⍺←'assertion failure' ⋄ 0∊⍵:⍺ ⎕SIGNAL 8 ⋄ shy←0}
4+
5+
⍝ ignoring punctuation and casing?
6+
Assert'CMOS'≡Acronym'Complementary metal-oxide semiconductor'
7+
8+
⍝ ignores punctuation?
9+
Assert'FIFO'≡Acronym'First In, First Out'
10+
11+
⍝ from phrases with acronyms?
12+
Assert'GIMP'≡Acronym'GNU Image Manipulation Program'
13+
14+
⍝ from phrases with apostrophes?
15+
Assert'HC'≡Acronym'Halley''s Comet'
16+
17+
⍝ from title case?
18+
Assert'PNG'≡Acronym'Portable Network Graphics'
19+
20+
⍝ from lower case?
21+
Assert'ROR'≡Acronym'Ruby on Rails'
22+
23+
⍝ from a very long abbreviation?
24+
Assert'ROTFLSHTMDCOALM'≡Acronym'Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me'
25+
26+
⍝ from phrases with consecutive delimiters?
27+
Assert'SIMUFTA'≡Acronym'Something - I made up from thin air'
28+
29+
⍝ from phrases with underscore emphasis?
30+
Assert'TRNT'≡Acronym'The Road _Not_ Taken'
31+
32+
result←'All tests passed.'
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Instructions
2+
3+
The classical introductory exercise.
4+
Just say "Hello, World!".
5+
6+
["Hello, World!"][hello-world] is the traditional first program for beginning programming in a new language or environment.
7+
8+
The objectives are simple:
9+
10+
- Modify the provided code so that it produces the string "Hello, World!".
11+
- Run the test suite and make sure that it succeeds.
12+
- Submit your solution and check it at the website.
13+
14+
If everything goes well, you will be ready to fetch your first real exercise.
15+
16+
[hello-world]: https://en.wikipedia.org/wiki/%22Hello,_world!%22_program
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
{
3+
"authors": [
4+
"jonocarroll"
5+
],
6+
"contributors": [
7+
"rikedyp"
8+
],
9+
"files": {
10+
"solution": [
11+
"Hello-World.aplf"
12+
],
13+
"test": [
14+
"Test_Hello-World.aplf"
15+
],
16+
"example": [
17+
".meta/example.aplf"
18+
]
19+
},
20+
"blurb": "Exercism's classic introductory exercise. Just say \"Hello, World!\".",
21+
"source": "This is an exercise to introduce users to using Exercism",
22+
"source_url": "https://en.wikipedia.org/wiki/%22Hello,_world!%22_program"
23+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
HelloWorld←{'Hello, World!'}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
HelloWorld←{'Goodbye, Mars!'}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
result←Test_HelloWorld;Assert
2+
3+
Assert←{⍺←'assertion failure' ⋄ 0∊⍵:⍺ ⎕SIGNAL 8 ⋄ shy←0}
4+
5+
⍝ basic test
6+
Assert'Hello, World!'≡HelloWorld⍬
7+
8+
result←'All tests passed.'
9+

0 commit comments

Comments
 (0)