[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [External] : Re: List not getting filled up
From: |
uzibalqa |
Subject: |
RE: [External] : Re: List not getting filled up |
Date: |
Mon, 31 Jul 2023 01:34:37 +0000 |
------- Original Message -------
On Monday, July 31st, 2023 at 1:29 PM, Drew Adams <drew.adams@oracle.com> wrote:
> > > Another possibility is to go ahead and change
> > > the string "destructively", over and over, but
> > > create a new string from the result after each
> > > modification, and add that new string to the
> > > list. You can do that with `copy-seq',` format',
> > > or `concat'.
> >
> > Have also tried to go through the non-destructive route with this,
> > but the results are not the same. Any idea what might I be doing
> > wrong ? Have removed the first swap-chars and pass it directly to
> > the internal permute. Then I would not need to call swap-chars a
> > second time.
>
>
> I'm not looking at your code. I'm saying that
> if you can destructively modify the same string
> multiple times, and if you want a copy of each
> such result to be added to a list as a separate
> (i.e., new) string, you can just copy the string
> you modified and add that copy to your list.
>
> I said you can copy the string value of var `foo'
> using (copy-sequence foo) or (concat foo nil) or
> (format "%S" foo).
>
> I was wrong about the last one.
>
> (eq foo (copy-sequence foo)) ; -> nil
>
> (eq foo (concat foo nil)) ; -> nil
>
> (eq foo (format "%s" foo)) ; -> t
Upon further introspection I found that it makes a lot of difference
whether I use
(push (copy-sequence string) result)
or
(push string result)
Why is that ?
- List not getting filled up, uzibalqa, 2023/07/28
- Re: List not getting filled up, tpeplt, 2023/07/30
- Re: List not getting filled up, uzibalqa, 2023/07/30
- Re: List not getting filled up, Yuri Khan, 2023/07/30
- Re: List not getting filled up, uzibalqa, 2023/07/30
- RE: [External] : Re: List not getting filled up, Drew Adams, 2023/07/30
- RE: [External] : Re: List not getting filled up, uzibalqa, 2023/07/30
- RE: [External] : Re: List not getting filled up, Drew Adams, 2023/07/30
- RE: [External] : Re: List not getting filled up,
uzibalqa <=
- RE: [External] : Re: List not getting filled up, Drew Adams, 2023/07/30
- RE: [External] : Re: List not getting filled up, uzibalqa, 2023/07/30
- RE: [External] : Re: List not getting filled up, Heime, 2023/07/30