all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: uzibalqa <uzibalqa@proton.me>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Composing words from acronyms
Date: Tue, 25 Jul 2023 20:50:16 +0200	[thread overview]
Message-ID: <87sf9b3jpo.fsf@gnu.org> (raw)
In-Reply-To: <2_RZ8A26ry2Z_vdsYxjFkT_0ZLgEq5uRp_U0kAVw-7ssI8szprfyc99ejKXnnvZMLxFSgQog967qq1EliFMGzS9WVuJ1bzWXmT69NMkMWEk=@proton.me>

uzibalqa <uzibalqa@proton.me> writes:

> I would like to compose words from acronyms (e.g. 5-letter words,
> 4-letter words, etc).  For instance, from the acronym 'Emacs' I can
> compose 'maces'.
>
> Is this difficult to de in eamcs, and how may I approach this task ?

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.
     t)
   (mapcar (lambda (lst)
             (mapconcat #'char-to-string lst))
           (-permutations (string-to-list word)))))

For the TODO, you could probably use some dictionary file.

Bye,
Tassilo



  parent reply	other threads:[~2023-07-25 18:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25 18:28 Composing words from acronyms uzibalqa
2023-07-25 18:40 ` Emanuel Berg
2023-07-25 18:50 ` Tassilo Horn [this message]
2023-07-25 19:02   ` Emanuel Berg
2023-07-25 19:19   ` Emanuel Berg
2023-07-25 19:23   ` Emanuel Berg
2023-07-25 19:48     ` uzibalqa
2023-07-25 20:02       ` uzibalqa
2023-07-26 12:02         ` Emanuel Berg
2023-07-25 18:57 ` Emanuel Berg
2023-07-25 20:02 ` Yuri Khan
2023-07-25 20:26   ` uzibalqa
2023-07-26 11:15     ` Pierre Rouleau
2023-07-26 11:23       ` uzibalqa

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=87sf9b3jpo.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=help-gnu-emacs@gnu.org \
    --cc=uzibalqa@proton.me \
    /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.