Pure Programmer
Blue Matrix


Cluster Map

Project: The Farmer in the Dell (Revisited)

Write a program that prints the lyrics to the song "The Farmer in the Dell". Use a map to hold each person in the song as the key and the person that they "take" as the value. Write a function that prints one verse that takes the key as an argument and prints the correct verse. Write another function to print all the verses.

See [[The Farmer in the Dell]]

Output
$ rustc FarmerInTheDell2.rs error: this is a block expression, not an array --> FarmerInTheDell2.rs:11:2 | 11 | {"farmer", "wife"}, | ^^^^^^^^^^^^^^^^^^ | help: to make an array, use square brackets instead of curly braces | 11 | ["farmer", "wife"], | ~ ~ error: this is a block expression, not an array --> FarmerInTheDell2.rs:12:2 | 12 | {"wife", "child"}, | ^^^^^^^^^^^^^^^^^ | help: to make an array, use square brackets instead of curly braces | 12 | ["wife", "child"], | ~ ~ error: this is a block expression, not an array --> FarmerInTheDell2.rs:13:2 | 13 | {"child", "nurse"}, | ^^^^^^^^^^^^^^^^^^ | help: to make an array, use square brackets instead of curly braces | 13 | ["child", "nurse"], | ~ ~ error: this is a block expression, not an array --> FarmerInTheDell2.rs:14:2 | 14 | {"nurse", "cow"}, | ^^^^^^^^^^^^^^^^ | help: to make an array, use square brackets instead of curly braces | 14 | ["nurse", "cow"], | ~ ~ error: this is a block expression, not an array --> FarmerInTheDell2.rs:15:2 | 15 | {"cow", "dog"}, | ^^^^^^^^^^^^^^ | help: to make an array, use square brackets instead of curly braces | 15 | ["cow", "dog"], | ~ ~ error: this is a block expression, not an array --> FarmerInTheDell2.rs:16:2 | 16 | {"dog", "cat"}, | ^^^^^^^^^^^^^^ | help: to make an array, use square brackets instead of curly braces | 16 | ["dog", "cat"], | ~ ~ error: this is a block expression, not an array --> FarmerInTheDell2.rs:17:2 | 17 | {"cat", "mouse"}, | ^^^^^^^^^^^^^^^^ | help: to make an array, use square brackets instead of curly braces | 17 | ["cat", "mouse"], | ~ ~ error: this is a block expression, not an array --> FarmerInTheDell2.rs:18:2 | 18 | {"mouse", "cheese"} | ^^^^^^^^^^^^^^^^^^^ | help: to make an array, use square brackets instead of curly braces | 18 | ["mouse", "cheese"] | ~ ~ error[E0599]: no method named `at` found for struct `HashMap` in the current scope --> FarmerInTheDell2.rs:22:34 | 22 | let otherPerson:String = people.at(who); | ^^ method not found in `HashMap<String, String>` error[E0599]: no method named `at` found for struct `HashMap` in the current scope --> FarmerInTheDell2.rs:41:21 | 41 | person = &(people.at(person)); | ^^ method not found in `HashMap<String, String>` error: aborting due to 10 previous errors For more information about this error, try `rustc --explain E0599`.

Solution