Re: ( Substring function in Python, Lisp) -- [Hijack] contains [hijk]

Liste des GroupesRevenir à cl python 
Sujet : Re: ( Substring function in Python, Lisp) -- [Hijack] contains [hijk]
De : enometh (at) *nospam* meer.net (Madhu)
Groupes : comp.lang.lisp
Date : 17. Feb 2025, 08:09:05
Autres entêtes
Organisation : Motzarella
Message-ID : <m3msel59pq.fsf@leonis4.robolove.meer.net>
References : 1 2 3 4 5
* HenHanna <507d06f8062ea2f4dc1b226979b23021@www.novabbs.com> :
Wrote on Sun, 16 Feb 2025 18:33:58 +0000:
On Sun, 16 Feb 2025 15:43:20 +0000, Madhu wrote:

[Badly proofread, sorry.  The letters "LCA" are meaningless in this
context.  it could be LIS (longest increasing subsequence)]

Using a suitable implementaion in a stupid way:
(defun lca (string)
(map 'string 'code-char (lca::longest-inc-seq (map 'list 'char-code
string))))
>
and running it on to extract into a hashtable with the keys as lcas
>
(hash-table-count $h2)
;; => 20437
>
(gethash "abcde" $h2)
("oxylabracidae" "cerambycidae" "bambocciade" "amoebicide" "ambuscade"
"absconded" "aborticide")
>
>
(sort (mapcar (lambda (x) (cons (car x) (length (cdr x))))
(group2 (hash-keys $h2) :test #'= :key #'length))
#'< :key #'car)
>
;; "length of lca . number of words"
((2 . 241) (3 . 1596) (4 . 4833) (5 . 7024) (6 . 4961) (7 . 1545) (8 .
217)
(9 . 19) (10 . 1))
____________
>
(9 . 19) (10 . 1))
>
wow....  I'd love to know what these Longest words are!
who is the  (sole)  Grand winner?

This historgram was of just the keys, or the subsequences, not the
words.  The longest increasing subsequence was of length 10,
"achilopsty" and the word was

(gethash "achilopsty" $h2)
;; => ("tarsochiloplasty"), T

#||
lrwxrwxrwx 1 root root 4 Dec 28  2020 /usr/share/dict/words -> web2
-rw-r--r-- 1 root root 2486824 Oct 21  2000 /usr/share/dict/web2
||#




Date Sujet#  Auteur
7 Jun 25 o 

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal