[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Change a string in to a identical list
From: |
Jean Abou Samra |
Subject: |
Re: Change a string in to a identical list |
Date: |
Thu, 4 Jun 2020 20:59:56 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 |
Hello,
https://www.gnu.org/software/guile/manual/html_node/List_002fString-Conversion.html
Carl
Carl:
I know about that section but i do not know how to make any thing
there work for this
Do you have an example?
Thank you,ƒg
This is:
(string->list "abcd")
returning (#\a #\b #\c #\d).
This procedure converts a string into a list of
characters.
You may want a list of single-character strings instead.
Then here you go:
(map string (string->list "abcd"))
Thas gives ("a" "b" "c" "d").
The other one on the same page is for splitting a string
following certain criteria. For example, if you want to split
by spaces, then that would be
(string-split "Hello world!" #\space)
resulting in ("Hello" "world!").
That said, I don't really understand why you are mixing
numbers and letters in your strings. As David suggested,
it would be more natural to start with a list. And if
you provide context about what you're trying to achieve,
we likely can give more helpful answers.
Best,
Jean Abou Samra
- Re: Change a string in to a identical list,
Jean Abou Samra <=