From: Joseph O'Rourke
Subject: Exploding a string into a list of character atoms?
Date: 
Message-ID: <R.521lbf$s2u@sylvia.smith.edu>
Reposting article removed by rogue canceller.

Is there a function to take a string like "string" and return
the list (S T R I N G)?  (I am using GCL.)  Thanks for any help!

From: Erik Naggum
Subject: Re: Exploding a string into a list of character atoms?
Date: 
Message-ID: <3052550412441563@naggum.no>
[Joseph O'Rourke]

|   Is there a function to take a string like "string" and return the list
|   (S T R I N G)?  (I am using GCL.)  Thanks for any help!

do you really want to use interned _symbols_ to represent each character?

if you only want characters, take a look at `coerce', as in

    (coerce "string" 'list)
    => (#\s #\t #\r #\i #\n #\g)

#\Erik
-- 
Those who do not know Lisp are doomed to reimplement it.
From: Stefan Bamberger
Subject: Re: Exploding a string into a list of character atoms?
Date: 
Message-ID: <bambi-2409961451270001@wi6a84.informatik.uni-wuerzburg.de>
In article <············@sylvia.smith.edu>, ·······@grendel.csc.smith.edu
(Joseph O'Rourke) wrote:

> Reposting article removed by rogue canceller.
> 
> Is there a function to take a string like "string" and return
> the list (S T R I N G)?  (I am using GCL.)  Thanks for any help!

(defun explode (item)
  (flet ((*care-string (thing)
           (format nil "~a" thing))
         (*create-symbol (charac)
           (intern (string (char-upcase charac))))
         )
    (let ((str (*care-string item))
          (erglist nil)
          )
      (dotimes (i (length str) (nreverse erglist))
        (push (*create-symbol (char str i))
              erglist)
        )
      )))

That's what I use to do that.

- stefan
From: Erik Naggum
Subject: Re: Exploding a string into a list of character atoms?
Date: 
Message-ID: <3052584284165996@naggum.no>
[Stefan Bamberger]

|   > Is there a function to take a string like "string" and return
|   > the list (S T R I N G)?  (I am using GCL.)  Thanks for any help!
|   
|   (defun explode (item)
|     (flet ((*care-string (thing)
|              (format nil "~a" thing))
|            (*create-symbol (charac)
|              (intern (string (char-upcase charac))))
|            )
|       (let ((str (*care-string item))
|             (erglist nil)
|             )
|         (dotimes (i (length str) (nreverse erglist))
|           (push (*create-symbol (char str i))
|                 erglist)
|           )
|         )))
|   
|   That's what I use to do that.

you do?  really?

I already mentioned this:

    (coerce "string" 'list)
    => (#\s #\t #\r #\i #\n #\g)

but if you insist om making symbols:

    (defun explode (string)
      (mapcar #'(lambda (char) (intern (string (char-upcase char))))
	      (coerce string 'list)))

    (explode "string")
    => (s t r i n g)

a simple comparison using CMUCL at (optimize (speed 3)) says that your
function conses 848 bytes, while mine conses 208 bytes, that your function
requires 531 �s (microseconds) of CPU time on a 50MHz SPARC 2, while mine
requires 293 �s.  compared to this, (coerce "string" 'list) takes 101 �s
and conses 56 bytes, basically the 6 cons cells.  YMMV.

#\Erik
-- 
Those who do not know Lisp are doomed to reimplement it.
From: Rainer Joswig
Subject: Re: Exploding a string into a list of character atoms?
Date: 
Message-ID: <joswig-2509960013590001@news.lavielle.com>
In article <············@sylvia.smith.edu>, ·······@grendel.csc.smith.edu
(Joseph O'Rourke) wrote:

> Reposting article removed by rogue canceller.
> 
> Is there a function to take a string like "string" and return
> the list (S T R I N G)?  (I am using GCL.)  Thanks for any help!

(defun explode (string)
  (loop for char character across string
        collect (intern (string (char-upcase char)))))