[Purdue-pm] challenge problem for next meeting?
Mark Senn
mark at ecn.purdue.edu
Wed Jul 29 09:30:06 PDT 2015
Mark Senn <mark at purdue.edu> wrote on 2015-07-29 at 10:59 -04:
| Is there interest in this challenge problem for the next meeting?
| Write back if you'll talk, email, or blog about your solution.
| Given a list of names, for example
| Abe
| Alan
| Ben
| Cat
| Cathy
| print a list of all names, shortening them as much
| as possible, with them still remaining unique, like this
| Ab
| Abe
| Al
| Ala
| Alan
| B
| Be
| Ben
| Cat
| Cath
| Cathy
| in Perl 5 and Perl 6.
|
| Read the names from a Perl data section one name per line.
| Do error checking to make sure you aren't given duplicate names.
| Perl 6 has grammars
| http://doc.perl6.org/language/grammars
| and sets, bags, and mixes:
| http://doc.perl6.org/language/setbagmix
Michael Gribskov <gribskov at purdue.edu> wrote on 2015-07-29 at 11:56:39 -04:
| Do you want the output to be unique, e.g., both Cat and Cathy contain
| CAT, should it occur only once in output?
Yes, just once. After the program runs
(This column is not part of the original problem
definition, I only added it to give an example of
what I mean in the paragraph following this list.)
THESE NAMES COULD REFER TO THESE PEOPLE
----------- --------------------------------------------------
Ab Abe Abe Lincoln
Al Ala Alan Alan Turing
B Be Ben Ben Carson
Cat Cat Stevens
Cath Cathy Cathy Rigby
Cath is not shortened to Cat because we'd get Cat Stevens
and Cathy Rigby confused.
-mark
More information about the Purdue-pm
mailing list