Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #197267

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

Path csiph.com!xmission!news.snarked.org!news.nk.ca!rocksolid2!i2pn2.org!.POSTED!not-for-mail
From HenHanna <HenHanna@dev.null>
Newsgroups rec.puzzles, comp.lang.lisp, comp.lang.python
Subject Re: ( Substring function in Python, Lisp) -- [Hijack] contains [hijk]
Date Mon, 17 Feb 2025 11:50:35 +0000
Organization novaBBS
Message-ID <dda7674b2965a291973553f5e269768b@www.novabbs.com> (permalink)
References <7513d4f4cf89bfd31edda3eb5ed84052@www.novabbs.com> <m3o6z2wvuh.fsf@leonis4.robolove.meer.net> <874j0ucpn1.fsf@nightsong.com> <m3r03xvqsn.fsf@leonis4.robolove.meer.net> <507d06f8062ea2f4dc1b226979b23021@www.novabbs.com> <m3msel59pq.fsf@leonis4.robolove.meer.net>
MIME-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
Injection-Info i2pn2.org; logging-data="455161"; mail-complaints-to="usenet@i2pn2.org"; posting-account="4L8HabKtc1alsSAOmk7EUGDHKRhgGhC+6gJMfTsJB0A";
User-Agent Rocksolid Light
X-Face P#KeQ)CUdd!==@fw~Ms1=,Hb`IWtb6:Mw)x3B=H1BfNC\lz?Nb&)M9}$>?'X7l;CuB}utlJ=PHsRBSG6X>dYZ$[>P]$~+`>@V6$t}hTLoQ7XC~W\>:`B3ALU]SH;d(\MEc}znW8m}-ma&yPFkJ2@KSQrz=!Y;><;6a>z6N+mt`ClCt.PAE<o+B$qjwejZSZ,w]^;vrdl24z5(pm={l,F10qRDF
X-Rslight-Site $2y$10$9/lxFBOcriWb6nKicQ6as.pfdAR6JRPeZai0J3cQKXITKLyFsLGEu
X-Spam-Checker-Version SpamAssassin 4.0.0
X-Rslight-Posting-User abae1fed5a82111a8790dc84735f550edb4392db
Xref csiph.com rec.puzzles:26477 comp.lang.lisp:60255 comp.lang.python:197267

Cross-posted to 3 groups.

Show key headers only | View raw


On Mon, 17 Feb 2025 7:09:05 +0000, Madhu wrote:

> * 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
> ||#

______________

> tarsochiloplasty

thank you... that word is in the dictionary I'm using.

         This looks good too:         abdominoplasty


                 whch contains         abd  in   opsty
                                       ach  il   opsty


  abdominoplasty -- is shorter and its meaning is kinda obvious!

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

( Substring function in Python, Lisp)  --  [Hijack]  contains  [hijk] HenHanna <HenHanna@dev.null> - 2025-02-15 21:36 +0000
  Re: ( Substring function in Python, Lisp)  --  [Hijack]  contains  [hijk] richard@cogsci.ed.ac.uk (Richard Tobin) - 2025-02-16 00:18 +0000
    Re: ( Substring function in Python, Lisp)  --  [Hijack]  contains  [hijk] Paul Rubin <no.email@nospam.invalid> - 2025-02-15 23:43 -0800
      Re: ( Substring function in Python, Lisp)  --  [Hijack]  contains  [hijk] HenHanna <HenHanna@dev.null> - 2025-02-16 13:37 +0000
      Re: ( Substring function in Python, Lisp)  --  [Hijack]  contains  [hijk] richard@cogsci.ed.ac.uk (Richard Tobin) - 2025-02-16 19:02 +0000
  Re: ( Substring function in Python, Lisp) -- [Hijack] contains [hijk] "Carl G." <carlgnews@microprizes.com> - 2025-02-16 11:44 -0800
  Re: ( Substring function in Python, Lisp)  --  [Hijack]  contains  [hijk] HenHanna <HenHanna@dev.null> - 2025-02-17 11:50 +0000
  Re: ( Substring function in Python, Lisp) -- [Hijack] contains [hijk] "B. Pym" <Nobody447095@here-nor-there.org> - 2025-06-06 15:17 +0000

csiph-web