[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: comic-book-insult
From: |
Emanuel Berg |
Subject: |
Re: comic-book-insult |
Date: |
Wed, 11 Sep 2019 01:43:55 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
Adam Porter wrote:
> seq.el makes this even easier:
>
> (seq-sort (lambda (_ _) (zerop (random 2)))
> "01234") ;;=> "01423"
Note: One has to use _ and __, otherwise the
byte-compiler warns "Warning: repeated
variable _ in lambda-list".
Other than that, OK:
(require 'seq)
(defun scramble-string (str)
"Randomize the characters of a string."
(interactive "sscramble me: ")
(let ((rand-str (seq-sort (lambda (_ __) (zerop (random 2))) str )))
(if (called-interactively-p 'any)
(message rand-str)
rand-str) ))
(defun comic-book-insult ()
(interactive)
(insert (concat (scramble-string "@#$%&") "!") ))
;; (comic-book-insult) ; @#$%&!
;; (comic-book-insult) ; $&#@%!
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
- 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, 2019/09/10
- Re: comic-book-insult,
Emanuel Berg <=