Autoreferential letter count

I propose the following for the next week quiz:

Write a ruby program that takes a sentence as its input an produces an
output that autoreferentially describes the letters found in the
sentence and the description itself.

This is an example in italian:

Questa nota contiene esattamente: cinque A sette C nove D diciotto E
dodici I due M otto N undici O tre Q due R sei S diciotto T sette U
due V.

That means:

This note contains exactly: five A’s seven C’s nine D’s eighteen E’s
twelve I’s two M’s eight N’s eleven O’s three Q’s two R’s six S’s
eighteen T’s seven U’s two V’s.

(which is false, but its’ true in the italian version).

I’m sorry I don’t have an English example at the moment, but I hope
that the problem is quite easy to understand anyway.

Paolo

Quoting Paolo C. [email protected]:

I propose the following for the next week quiz:

Write a ruby program that takes a sentence as its input an
produces an output that autoreferentially describes the letters
found in the sentence and the description itself.

Interesting. This is basically equivalent to writing a function
which takes a message and produces a combined message + header,
where the header includes a checksum/digest of the combined message

  • header.

I don’t believe that’s possible in general, but it may be in
specific cases, depending on the properties of the particular
checksumming algorithm chosen.

-mental

On Nov 18, 2005, at 11:15 AM, [email protected] wrote:

Interesting. This is basically equivalent to writing a function
which takes a message and produces a combined message + header,
where the header includes a checksum/digest of the combined message

  • header.

I don’t believe that’s possible in general, but it may be in
specific cases, depending on the properties of the particular
checksumming algorithm chosen.

Hmm, I’m not sure that makes a great quiz then, unless we supply a
good number of test cases known to work.

James Edward G. II

Hi!

At Sat, 19 Nov 2005 01:59:59 +0900, Paolo C. wrote:

I propose the following for the next week quiz:

Write a ruby program that takes a sentence as its input an produces
an output that autoreferentially describes the letters found in the
sentence and the description itself.

As long as one restricts oneself to a single language that is no
problem but as soon as several languages are involve things become
naughty. Dutch 'coördinatie" (coordination) contains

1 a, 2 c, 1 d, 1 e, 2 i, 1 n, 2 o, 1 r, 1 t

while German “Diätplan” contains

1 a, 1 ä, 1 d, 1 i, 1 l, 1 n, 1 p, 1 t

You see that depending on the language the trema either introduces a
new letter or not.

Even if a German sentence contains no umlaut (ä, ö, ü) at all, the
count still may because 5 reads ‘fünf’ (as a result the
‘ü’ iscontained in any number containing the digit ‘5’), and 12 reads
"zwölf’.

Tot ziens,

Josef ‘Jupp’ Schugt