[Top][All Lists]

[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 09:54:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Marcin Borkowski wrote:

>>   eht kudtce pigelsen tagni ogod seot erontuf si ni fo hte
>> Easy LOL :) The first word should be "the"!
> I'm not sure if it's just permutations. "kudtce" could be
> "tucked", but "erontuf"?

Indeed it can't,

  (member "erontuf" (string-perms "kudtce")) ; nil

> Anyway, I would personally permute only consonants - if the
> vowels are out of order, the brain can often fill in the
> blanks pretty easily.

Good point, OTOH that's the beauty with programming, you have
to use your brain a lot so that you don't have to do that
anymore - at all! Luckily we haven't reached the point yet
where every problem can and is solved by a machine better than
a human being. So there are still stuff for us to do! Like for
example working on it ...

> Also, it would be great to leverage ispell to exclude
> non-words from the list of permutations - unfortunately,
> I don't know how to do it

Right, I asked some time ago why there isn't a lispy function
to spell a single word, I got the answer there's no use case
for that, I don't remember what the use case was back then but
now we know there are at least two. Anyway I did this, it uses
how ispell work when you use it interactively which,
admittedly, doesn't look good but in terms of the interface it
is usable with and from Lisp:

(defun spell-word (word)
      (insert word) )
    (condition-case nil
        (not (ispell-word))
      (error nil) )))
;; (spell-word "length") ; t
;; (spell-word "lenght") ; nil

> (calc-eval "fact(5)") => "120"
> (calc-eval "fact(10)") => "3628800"

Indeed, however that isn't lispy either ...

Good that there is this list, suddenly I have stuff to do
again :)

underground experts united

reply via email to

[Prev in Thread] Current Thread [Next in Thread]