[Beowulf] A start in Parallel Programming?

Joe Landman landman at scalableinformatics.com
Tue Mar 20 09:59:18 EDT 2007


Robert G. Brown wrote:
> On Mon, 19 Mar 2007, Joe Landman wrote:
> 
>> ps disclosure: FWIW I do play the occasional Perl golf.  Last one I
>> played with was to write a roman numeral calculator (c.f.
>> http://www.fonality.com/golf/ and
>> http://www.fonality.com/golf/post_mortem.cgi?id=1).
> 
> Just for grins I did this too (and thanks for nothing -- gawds, all I
> need is another mindless programming task:-)

Heh... Well last I checked I was #53 or so on there.  350 characters for 
a roman numeral calculator.  After it was over, I learned how to shave 
20-30 characters off.

Not that this is a useful skill or anything like that, but it was a 
challenge.

Sort of like Sudoku.  Or the chess Queens problem.

> The only problem I have with it is the "least number of keystrokes"
> thing.  I personally think that this part at the very least needs to be
> "in the active subroutine, exclusive of debugging code" to eliminate the
> trivial overhead of getting the number in from the command line or
> whereever and various good-practice things like comments, indentation,
> newlines.

Actually I think minimal number of keystrokes is not necessarily the 
right way to do things.  Having programmed in APL ages ago, I can tell 
you that some abstractions are better left untouched ...

> The other problem I have with the challenge is that a) the test strings
> are all trivial and are far from exhaustive of the available test space;

This is curiously what separates the approaches. The most common short 
approach is to avoid doing conversions, but to run a loop over the 
indices 1 to 3999 and generate roman numerals from that.  Then when 
there is a match, use that in the calculation.  Saves having to do a 
forward/backwards conversion.  Wasteful on memory/time.  But sure saves 
on keystrokes.  Also, I cannot for the life of me mentally parse some of 
those "programs".


> b) the routine doesn't have to REJECT strings that are technically
> invalid (or at least odd) since the "roman numeral algorithm" isn't
> single valued without additional restriction.  For example,
> 
>   XLII = 42 = VIIIL = XXXXII?
> 
> (Note well that the answer in all cases, curiously enough, is "42",
> hmmmm:-)

Yeah ... but whats the question ...





-- 

Joseph Landman, Ph.D
Founder and CEO
Scalable Informatics LLC,
email: landman at scalableinformatics.com
web  : http://www.scalableinformatics.com
phone: +1 734 786 8423
fax  : +1 734 786 8452 or +1 866 888 3112
cell : +1 734 612 4615

_______________________________________________
Beowulf mailing list, Beowulf at beowulf.org
To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf

!DSPAM:45ffe8fa316552889862676!



More information about the Beowulf mailing list