|
From: | Emanuel Berg |
Subject: | Re: Composing words from acronyms |
Date: | Tue, 25 Jul 2023 21:02:57 +0200 |
User-agent: | Gnus/5.13 (Gnus v5.13) |
Tassilo Horn wrote: > It's a bit cheating but the dash package has a -permutations > function which does the job. > > (defun acronyms (word) > (seq-filter > (lambda (acronym) > ;; TODO: check if acronym is actually a sensible word [...] You mean like this? :) (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) )) It checks if it is a real word by spellchecking it. Source: https://dataswamp.org/~incal/emacs-init/perm.el https://dataswamp.org/~incal/emacs-init/spell.el -- underground experts united https://dataswamp.org/~incal
[Prev in Thread] | Current Thread | [Next in Thread] |