This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

String + 1

2 posts · 3933 views

Hi everyone . i need to write a function in lisp that receive string and then add 1 to each characters. for example "2a6c12" and then return "3b7d23".

i write this function

(defun my-list(f)
(loop for x across f collect(code-char(+ 1 (char-code x)))))

but my output like this (#\3 #\b #\7 #\d #\2 #\3) . how can i change this output to normal form ("3b7d23")


tnx a lot

Re: String + 1

Try this:
(concatenate 'string '(#\a #\b))
or ugglier:
(coerce '(#\a #\b) 'string)
cl-2dsyntax is my attempt to create a Python-like reader. My mirror of CLHS (and the dark themed version). Temporary mirrors of aferomentioned: CLHS and a dark version.