[Haskell-beginners] Help!!
Jessica Baker
jessicamaybaker at gmail.com
Wed Mar 9 17:00:05 CET 2011
3.1 Step 1
Create a Haskell script le called crypt.hs and enter the code for he Caesar
cipher from
Section 5.5 of the text book (Hutton). Make sure you understand how all the
functions
work.
3.2 Step 2
Transform your script le (from Step 1) into a Haskell program that reads
text from the
standard input, encrypts the text using the Caesar cipher, and writes the
result to the
standard output. Your program should take a command-line argument that
species the
shift factor to be used. So, for example:
cat poem.txt | ./crypt 3
Eqvdqjxlqlqj wkh vnb
Hrz khdylob lw glhv
Iqwr wkh Whvw dzdb
Pdvw wrxfk dqg vljkw dqg vrxqg
Nr orqjhu wr eh irxqg
Hrz krshohvv xqghujurxqg
Fdoov wkh uhpruvhixo gdb
If the command-line argument is 0 (zero) then the program should crack the
code and
output the deciphered text. So, the following command pipeline should echo
the original
message:
cat poem.txt | ./crypt 3 | ./crypt 0
Ensanguining the sky
How heavily it dies
Into the West away
Past touch and sight and sound
No longer to be found
How hopeless underground
Falls the remorseful day
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20110309/0393e956/attachment.htm>
More information about the Beginners
mailing list