[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: comic-book-insult
From: |
Adam Porter |
Subject: |
Re: comic-book-insult |
Date: |
Sun, 08 Sep 2019 17:29:57 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Emanuel Berg via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:
> (defun scramble-string (str)
> "Randomize the characters of a string."
> (interactive "sscramble me: ")
> (let*((empty-str "")
> (chars (delete empty-str (split-string str empty-str)))
> (rand-chars (sort chars (lambda (_ __) (zerop (random 2)))))
> (rand-str (mapconcat 'identity rand-chars ""))
> )
> rand-str) )
>
> (defun comic-book-insult ()
> (interactive)
> (insert (concat (scramble-string "@#$%&") "!") ))
>
> ;; (comic-book-insult) ; %@&$#!
> ;; (comic-book-insult) ; $%#@&!
seq.el makes this even easier:
(seq-sort (lambda (_ _)
(zerop (random 2)))
"01234") ;;=> "01423"
- Re: comic-book-insult, (continued)
Re: comic-book-insult, Jean Louis, 2019/09/09
- Re: comic-book-insult, Emanuel Berg, 2019/09/09
- Re: comic-book-insult, Jean Louis, 2019/09/09
- Re: comic-book-insult, Emanuel Berg, 2019/09/09
- Re: comic-book-insult, Eli Zaretskii, 2019/09/09
- Anonymous arguments - Re: comic-book-insult, Jean Louis, 2019/09/11
- Re: Anonymous arguments - Re: comic-book-insult, Emanuel Berg, 2019/09/11
- Re: Anonymous arguments - Re: comic-book-insult, Jean Louis, 2019/09/17
Re: comic-book-insult,
Adam Porter <=