From: Cad Bilbao
Subject: How to add characters to an atom?
Date: 
Message-ID: <604dab8.0111230458.119b7dca@posting.google.com>
Hi again?

If I try:
(setf my-List(cons my-char my-List))

,I add an 'char-atom' (my-char) to my-List, but I would like to add a
char to an atom/word within myList.

I mean, I want to add 'n' to 'Joh' --> John
And afterwards,
(setf my-List(cons 'John my-List))

Any sugestion? Thank you very much

From: Erik Haugan
Subject: Re: How to add characters to an atom?
Date: 
Message-ID: <87vgg1ppic.fsf@kometknut.neitileu.no>
* ···@bilbao.com (Cad Bilbao)
> (setf my-List(cons my-char my-List))

You should _really_ work on your style as several others have pointed out.
A real lisper would write your expression as (observe the spacing and case):

(setf my-list (cons my-char my-list))

Furthermore he would use push:

(push my-char my-list)

> ,I add an 'char-atom' (my-char) to my-List, but I would like to add a
> char to an atom/word within myList.
> 
> I mean, I want to add 'n' to 'Joh' --> John
> And afterwards,
> (setf my-List(cons 'John my-List))

This makes no sense whatsoever, I think you must be seriously confused about
something.  Can you please tell us what you think you're trying to do?  In
plain English?

Erik
From: Dr. Edmund Weitz
Subject: Re: How to add characters to an atom?
Date: 
Message-ID: <m34rnl7fg5.fsf@bird.agharta.de>
···@bilbao.com (Cad Bilbao) writes:

> Hi again?
> 
> If I try:
> (setf my-List(cons my-char my-List))
> 
> ,I add an 'char-atom' (my-char) to my-List, but I would like to add a
> char to an atom/word within myList.
> 
> I mean, I want to add 'n' to 'Joh' --> John
> And afterwards,
> (setf my-List(cons 'John my-List))
> 
> Any sugestion? Thank you very much

If you want to manipulate _strings_ you should take a look at the CLHS
entries for CONCATENATE and (SETF (SUBSEQ ...) ...) for example -
remember that strings are one-dimensional arrays (i.e. vectors) and
thus sequences. You can use all functions that manipulate vectors or
sequences to manipulate your strings.

Try something like the following in your listener:

  (concatenate 'string "Joh" "n")
  (concatenate 'string "Joh" (coerce '(#\n) 'string))
  (let ((s "Gamma"))
    (setf (subseq s 0 4) "Kapp")
    (print s)
    (setf (aref s 0) #\Z)
    s)
 
If you want to manipulate _symbols_ on a per-character basis you'll
have to convert them to strings and then back to symbols. See INTERN
and SYMBOL-NAME in the CLHS.

Also, try (PUSH 'JOHN MY-LIST) instead of (SETF MY-LIST (CONS 'JOHN
MY-LIST)). Your CL implementation might macroexpand the first form to
something that's similar to the second form, but obviously the
intention of the first form is easier grasp for the human reader.

HTH,
Edi.
From: Erik Naggum
Subject: Re: How to add characters to an atom?
Date: 
Message-ID: <3215526552835598@naggum.net>
* Cad Bilbao
| If I try: (setf my-List(cons my-char my-List)) ,I add an 'char-atom'
| (my-char) to my-List, but I would like to add a char to an atom/word
| within myList.

  What kind of Common Lisp tutorials are you using or have you used?

///
-- 
  Norway is now run by a priest from the fundamentalist Christian People's
  Party, the fifth largest party representing one eighth of the electorate.
-- 
  Carrying a Swiss Army pocket knife in Oslo, Norway, is a criminal offense.