help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : Re: List not getting filled up


From: Drew Adams
Subject: RE: [External] : Re: List not getting filled up
Date: Mon, 31 Jul 2023 01:29:04 +0000

> > 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]