Hello all,
I am a big Lisp-Newb and am struggling with a program that is supposed to encrypt a string with Caesar's cipher. What I have in mind is a function that takes in 2 arguments: a string and a number to specify the modulus. Something along the lines:
(defun c-encrypt (string number)
("lots of helper functions"))
My thoughts so far are that it would be best to set the alphabet as a parameter and write a function that looks up a char's position in the parameter and then shifts it the wanted Caesar's modulo to the right e.g. A ->modulo 7 -> H
May look something along the lines:
CODE
(defparameter *alphabet* " abcdefghijklmnopqrstuvwxyz")
(defun alphabet-index (character) (...)) "looks up the index of the character in *alphabet*"
(defun shift (character x) ((alphabet-index (character)) (mod(+24 x"being the wanted modulo")27)))
Then I could take that function and mapcar it over the list of characters that are the input-string in single letters:
Well, I ran headfirst into a lot of problems. First of all, I can not find a function to split a string into its single chars (convert it to numbers fine, but simply split it...).
When trying to concatenate or looping there are always these darn #\ left which make it impossible to use the parameter.
As you see I already fail at the first obstacle of the whole project...

Not to speak about the rest...
Any help would be greatly appreciated since I really start to get frustrated about this project and Lisp itself. For some reason I find it extremely difficult to "think Lisp".
Thanks already for your answers!