From: uzibalqa <uzibalqa@proton.me>
To: uzibalqa <uzibalqa@proton.me>
Cc: uzibalqa via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org>
Subject: Re: Copying a string
Date: Sun, 30 Jul 2023 21:31:50 +0000 [thread overview]
Message-ID: <mwyZx3xw3yiOab_xHcatoo67Cdb55c16tGlBHXLqv29xouxpJnblvbN8v8qj0dARfomSxuLfqzRCPQ1BdrKHqQQu_xOrfXVN-nrcQ9zz4gI=@proton.me> (raw)
In-Reply-To: <v07QQJ-GedxNfUs3yjVhvV8vcmOknvNM8rC-IdpQ5LTV0def8EnYjz0TwswcVkgoJSAaSVQSSzJtZpzKj46XIW6HdBQlbD_dBtOf1HRRUMc=@proton.me>
Sent with Proton Mail secure email.
------- Original Message -------
On Monday, July 31st, 2023 at 9:07 AM, uzibalqa <uzibalqa@proton.me> wrote:
> I see many ways to copy a string
>
> (mutant (substring string))
> (mutant (copy-sequence string))
>
> Any others ways ? And what should one use routinely ?
I am swapping characters, I can use as I am doing '(mutant string)'
or as before I had (mutant (copy-sequence string))
I do not think it makes a difference, and that using (copy-sequence string)
would be overkill. Right ?
(defun swap-chars (string p q)
"Swap characters at INDEX1 and INDEX2 in STRING."
(let* ( (char1 (elt string p))
(char2 (elt string q))
(mutant string))
(aset mutant p char2)
(aset mutant q char1)
mutant))
next prev parent reply other threads:[~2023-07-30 21:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-30 21:07 Copying a string uzibalqa
2023-07-30 21:31 ` uzibalqa [this message]
2023-07-31 18:23 ` tpeplt
2023-07-31 0:55 ` [External] : " Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='mwyZx3xw3yiOab_xHcatoo67Cdb55c16tGlBHXLqv29xouxpJnblvbN8v8qj0dARfomSxuLfqzRCPQ1BdrKHqQQu_xOrfXVN-nrcQ9zz4gI=@proton.me' \
--to=uzibalqa@proton.me \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.