Skip to content

Commit 48c7abd

Browse files
authored
Add house (#368)
1 parent dc5cd07 commit 48c7abd

File tree

7 files changed

+536
-0
lines changed

7 files changed

+536
-0
lines changed

config.json

+8
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,14 @@
665665
"prerequisites": [],
666666
"difficulty": 5
667667
},
668+
{
669+
"slug": "house",
670+
"name": "House",
671+
"uuid": "ae838c07-9ba2-431e-99bd-e8f70a3be1e1",
672+
"practices": [],
673+
"prerequisites": [],
674+
"difficulty": 5
675+
},
668676
{
669677
"slug": "kindergarten-garden",
670678
"name": "Kindergarten Garden",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Instructions
2+
3+
Recite the nursery rhyme 'This is the House that Jack Built'.
4+
5+
> [The] process of placing a phrase of clause within another phrase of clause is called embedding.
6+
> It is through the processes of recursion and embedding that we are able to take a finite number of forms (words and phrases) and construct an infinite number of expressions.
7+
> Furthermore, embedding also allows us to construct an infinitely long structure, in theory anyway.
8+
9+
- [papyr.com][papyr]
10+
11+
The nursery rhyme reads as follows:
12+
13+
```text
14+
This is the house that Jack built.
15+
16+
This is the malt
17+
that lay in the house that Jack built.
18+
19+
This is the rat
20+
that ate the malt
21+
that lay in the house that Jack built.
22+
23+
This is the cat
24+
that killed the rat
25+
that ate the malt
26+
that lay in the house that Jack built.
27+
28+
This is the dog
29+
that worried the cat
30+
that killed the rat
31+
that ate the malt
32+
that lay in the house that Jack built.
33+
34+
This is the cow with the crumpled horn
35+
that tossed the dog
36+
that worried the cat
37+
that killed the rat
38+
that ate the malt
39+
that lay in the house that Jack built.
40+
41+
This is the maiden all forlorn
42+
that milked the cow with the crumpled horn
43+
that tossed the dog
44+
that worried the cat
45+
that killed the rat
46+
that ate the malt
47+
that lay in the house that Jack built.
48+
49+
This is the man all tattered and torn
50+
that kissed the maiden all forlorn
51+
that milked the cow with the crumpled horn
52+
that tossed the dog
53+
that worried the cat
54+
that killed the rat
55+
that ate the malt
56+
that lay in the house that Jack built.
57+
58+
This is the priest all shaven and shorn
59+
that married the man all tattered and torn
60+
that kissed the maiden all forlorn
61+
that milked the cow with the crumpled horn
62+
that tossed the dog
63+
that worried the cat
64+
that killed the rat
65+
that ate the malt
66+
that lay in the house that Jack built.
67+
68+
This is the rooster that crowed in the morn
69+
that woke the priest all shaven and shorn
70+
that married the man all tattered and torn
71+
that kissed the maiden all forlorn
72+
that milked the cow with the crumpled horn
73+
that tossed the dog
74+
that worried the cat
75+
that killed the rat
76+
that ate the malt
77+
that lay in the house that Jack built.
78+
79+
This is the farmer sowing his corn
80+
that kept the rooster that crowed in the morn
81+
that woke the priest all shaven and shorn
82+
that married the man all tattered and torn
83+
that kissed the maiden all forlorn
84+
that milked the cow with the crumpled horn
85+
that tossed the dog
86+
that worried the cat
87+
that killed the rat
88+
that ate the malt
89+
that lay in the house that Jack built.
90+
91+
This is the horse and the hound and the horn
92+
that belonged to the farmer sowing his corn
93+
that kept the rooster that crowed in the morn
94+
that woke the priest all shaven and shorn
95+
that married the man all tattered and torn
96+
that kissed the maiden all forlorn
97+
that milked the cow with the crumpled horn
98+
that tossed the dog
99+
that worried the cat
100+
that killed the rat
101+
that ate the malt
102+
that lay in the house that Jack built.
103+
```
104+
105+
[papyr]: https://papyr.com/hypertextbooks/grammar/ph_noun.htm
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"authors": [
3+
"BNAndras"
4+
],
5+
"files": {
6+
"solution": [
7+
"house.coffee"
8+
],
9+
"test": [
10+
"house.spec.coffee"
11+
],
12+
"example": [
13+
".meta/example.coffee"
14+
]
15+
},
16+
"blurb": "Output the nursery rhyme 'This is the House that Jack Built'.",
17+
"source": "British nursery rhyme",
18+
"source_url": "https://en.wikipedia.org/wiki/This_Is_The_House_That_Jack_Built"
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
class House
2+
@subjects: [
3+
'house that Jack built'
4+
'malt'
5+
'rat'
6+
'cat'
7+
'dog'
8+
'cow with the crumpled horn'
9+
'maiden all forlorn'
10+
'man all tattered and torn'
11+
'priest all shaven and shorn'
12+
'rooster that crowed in the morn'
13+
'farmer sowing his corn'
14+
'horse and the hound and the horn'
15+
]
16+
17+
@verbs: [
18+
'lay in'
19+
'ate'
20+
'killed'
21+
'worried'
22+
'tossed'
23+
'milked'
24+
'kissed'
25+
'married'
26+
'woke'
27+
'kept'
28+
'belonged to'
29+
]
30+
31+
@verse: (number) ->
32+
parts = ["This is the #{@subjects[number - 1]}"]
33+
for i in [number - 2..0] by -1
34+
parts.push "that #{@verbs[i]} the #{@subjects[i]}"
35+
parts.join(' ') + '.'
36+
37+
@verses: (startVerse, endVerse) ->
38+
result = []
39+
for i in [startVerse..endVerse]
40+
result.push @verse(i)
41+
result.join '\n'
42+
43+
module.exports = House
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This is an auto-generated file.
2+
#
3+
# Regenerating this file via `configlet sync` will:
4+
# - Recreate every `description` key/value pair
5+
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+
# - Preserve any other key/value pair
8+
#
9+
# As user-added comments (using the # character) will be removed when this file
10+
# is regenerated, comments can be added via a `comment` key.
11+
12+
[28a540ff-f765-4348-9d57-ae33f25f41f2]
13+
description = "verse one - the house that jack built"
14+
15+
[ebc825ac-6e2b-4a5e-9afd-95732191c8da]
16+
description = "verse two - the malt that lay"
17+
18+
[1ed8bb0f-edb8-4bd1-b6d4-b64754fe4a60]
19+
description = "verse three - the rat that ate"
20+
21+
[64b0954e-8b7d-4d14-aad0-d3f6ce297a30]
22+
description = "verse four - the cat that killed"
23+
24+
[1e8d56bc-fe31-424d-9084-61e6111d2c82]
25+
description = "verse five - the dog that worried"
26+
27+
[6312dc6f-ab0a-40c9-8a55-8d4e582beac4]
28+
description = "verse six - the cow with the crumpled horn"
29+
30+
[68f76d18-6e19-4692-819c-5ff6a7f92feb]
31+
description = "verse seven - the maiden all forlorn"
32+
33+
[73872564-2004-4071-b51d-2e4326096747]
34+
description = "verse eight - the man all tattered and torn"
35+
36+
[0d53d743-66cb-4351-a173-82702f3338c9]
37+
description = "verse nine - the priest all shaven and shorn"
38+
39+
[452f24dc-8fd7-4a82-be1a-3b4839cfeb41]
40+
description = "verse 10 - the rooster that crowed in the morn"
41+
42+
[97176f20-2dd3-4646-ac72-cffced91ea26]
43+
description = "verse 11 - the farmer sowing his corn"
44+
45+
[09824c29-6aad-4dcd-ac98-f61374a6a8b7]
46+
description = "verse 12 - the horse and the hound and the horn"
47+
48+
[d2b980d3-7851-49e1-97ab-1524515ec200]
49+
description = "multiple verses"
50+
51+
[0311d1d0-e085-4f23-8ae7-92406fb3e803]
52+
description = "full rhyme"

exercises/practice/house/house.coffee

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class House
2+
3+
@verse: (number) ->
4+
5+
@verses: (startVerse, endVerse) ->
6+
7+
module.exports = House

0 commit comments

Comments
 (0)