From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: avoid narrow-to-region (was: Re: replace-regexp)
Date: Sun, 09 May 2021 17:13:28 +0200 [thread overview]
Message-ID: <87eeeg0wkn.fsf@zoho.eu> (raw)
In-Reply-To: 87zgx40zqx.fsf@zoho.eu
> Let's do it like this, if we can get the algorithm to work
> on an arbitrary list, then all data-type issues can be
> solved easily, by adding two functions, one disassembly
> function that splits the data into a list, and one assembly
> function that puts it back together, after the algorithm has
> randomized it!
>
> So for example if the data is the string "data":
>
> 1. "data" -> '("d" "a" "t" "a")
> 2. run the algorithm, get e.g '("a" "d" "t" "a")
> 3. '("a" "d" "t" "a") -> "adta"
>
> Because Lisp is already based on the universal data
> structure which can express all human knowledge, isn't it
> possible that there is already a Lisp list randomizer that
> fulfills even Yuri's most uncompromising demands?
What about this?
;; https://stackoverflow.com/a/49505968
(require 'cl-lib)
(defun nshuff (sq)
(cl-loop
for i from (length sq) downto 2
do (cl-rotatef (elt sq (cl-random i))
(elt sq (1- i)) ))
sq)
;; (nshuff '(a b c)) ; (b c a) (a b c) (b c a) ...
Shufflepuck Café!
--
underground experts united
https://dataswamp.org/~incal
next prev parent reply other threads:[~2021-05-09 15:13 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-06 23:06 replace-regexp Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-07 6:54 ` replace-regexp Tassilo Horn
2021-05-07 18:28 ` replace-regexp Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-08 0:02 ` replace-regexp Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-08 0:16 ` replace-regexp Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-08 5:38 ` replace-regexp Yuri Khan
2021-05-08 13:53 ` replace-regexp Stefan Monnier via Users list for the GNU Emacs text editor
2021-05-08 18:41 ` replace-regexp Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-08 18:50 ` replace-regexp Stefan Monnier via Users list for the GNU Emacs text editor
2021-05-08 21:59 ` replace-regexp Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-08 22:03 ` replace-regexp Tassilo Horn
2021-05-08 22:25 ` replace-regexp Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-08 22:54 ` [External] : replace-regexp Drew Adams
2021-05-09 2:48 ` replace-regexp Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-08 18:46 ` replace-regexp Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-08 21:10 ` replace-regexp Stefan Monnier via Users list for the GNU Emacs text editor
2021-05-08 21:54 ` replace-regexp Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-08 23:11 ` replace-regexp Stefan Monnier via Users list for the GNU Emacs text editor
2021-05-08 23:16 ` replace-regexp Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-08 23:46 ` replace-regexp Stefan Monnier via Users list for the GNU Emacs text editor
2021-05-08 23:51 ` replace-regexp Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-09 7:38 ` replace-regexp Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-08 22:59 ` avoid narrow-to-region (was: Re: replace-regexp) Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-09 5:48 ` Yuri Khan
2021-05-09 6:09 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-09 6:34 ` Yuri Khan
2021-05-09 6:59 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-09 7:22 ` Jean Louis
2021-05-09 7:40 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-09 10:06 ` Yuri Khan
2021-05-09 10:54 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-09 12:27 ` Yuri Khan
2021-05-09 12:43 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-09 13:14 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-09 14:04 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-09 15:13 ` Emanuel Berg via Users list for the GNU Emacs text editor [this message]
2021-05-21 17:35 ` same sound random sort everywhere (was: Re: avoid narrow-to-region (was: Re: replace-regexp)) Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-21 20:12 ` Jean Louis
2021-05-21 20:47 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-05-07 8:02 ` replace-regexp Jean Louis
2021-05-07 18:29 ` replace-regexp Emanuel Berg via Users list for the GNU Emacs text editor
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=87eeeg0wkn.fsf@zoho.eu \
--to=help-gnu-emacs@gnu.org \
--cc=moasenwood@zoho.eu \
/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.