[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: puzzle with string permutations [photo]
From: |
Emanuel Berg |
Subject: |
Re: puzzle with string permutations [photo] |
Date: |
Tue, 07 Jun 2022 10:37:50 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Marcin Borkowski wrote:
> Also, it would be great to leverage ispell to exclude
> non-words from the list of permutations
That was sure a good idea!
(defun string-perms-filter (str)
(let ((strs (cl-remove-duplicates
(cl-remove-if-not (lambda (w) (spell-word w)) (string-perms str))
:test #'string=) ))
(if (= 1 (length strs))
(car strs)
strs) ))
;; (string-perms-filter "eht") ; the
;; (string-perms-filter "ogod") ; good
;; (string-perms-filter "erontuf")
;; (string-perms-filter "si") ; is
;; (string-perms-filter "kudtce") ; tucked
;; (string-perms-filter "ni") ; in
;; (string-perms-filter "hte") ; the
;; (string-perms-filter "pigelsen")
;; (string-perms-filter "seot") ; toes
;; (string-perms-filter "tagni") ; giant
By now I think I can guess "erontuf" (fortune) and "pigelsen"
(sleeping), those are more expensive to compute because of the
longer words but I'm confident in this method by now ...
https://dataswamp.org/~incal/emacs-init/perm.el
https://dataswamp.org/~incal/emacs-init/spell.el
--
underground experts united
https://dataswamp.org/~incal
- Re: puzzle with string permutations [photo], (continued)
- Re: puzzle with string permutations [photo], Marcin Borkowski, 2022/06/07
- Re: puzzle with string permutations [photo], Emanuel Berg, 2022/06/07
- Re: puzzle with string permutations [photo], Emanuel Berg, 2022/06/07
- Re: puzzle with string permutations [photo], Emanuel Berg, 2022/06/07
- Re: puzzle with string permutations [photo], Emanuel Berg, 2022/06/07
- Re: puzzle with string permutations [photo], Emanuel Berg, 2022/06/07
- Re: puzzle with string permutations [photo], Yuri Khan, 2022/06/07
- Re: puzzle with string permutations [photo], Emanuel Berg, 2022/06/07
- Re: puzzle with string permutations [photo], Emanuel Berg, 2022/06/07
- missing Lisp world (was: Re: puzzle with string permutations [photo]), Emanuel Berg, 2022/06/07
Re: puzzle with string permutations [photo],
Emanuel Berg <=