[REBOL] rot13
From: joel:neely:fedex at: 14-Dec-2003 13:56
First, thank you for the effort you've put into the ROT13 page
at:
http://www.miranda.org/~jkominek/rot13/
With respect to your page on REBOL:
http://www.miranda.org/~jkominek/rot13/rebol/rot13.r
and especially with respect to the "Note to others..."
I suggest that it is unfair to condemn a programming language on
the strength of an overly complicated, poorly-written function by
someone who is clearly unfamiliar with the language. I can think
of several ways to write the rot13 conversion in a much more
natural-to-REBOL style.
The quickest (for me) to write uses REBOL's object mechanism, and
generates the translation table algorithmically at object set-up
time (as a one-shot initialization to reduce risk of typos):
rot13: make object! [
xlate: make string! 78
for ch #"a" #"m" 1 [append xlate reduce [ch ch + 13 ch]]
for ch #"A" #"M" 1 [append xlate reduce [ch ch + 13 ch]]
code: func [s [string!] /local result] [
result: make string! length? s
foreach ch s [
insert tail result any [select/case xlate ch ch]
]
result
]
]
It would be invoked on a string by evaluating
rot13/code somestringexpression
and extending this to process an file (or standard input) is easy.
Again, thanks for the comparisons, and I hope to offer the above
comments in the spirit of assistance, not negativism!
-jn-