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

    From HenHanna@HenHanna@dev.null to rec.puzzles,comp.lang.lisp,comp.lang.python on Sat Feb 15 21:36:20 2025
    From Newsgroup: comp.lang.python

    The Substring function is a nice Programming puzzle.

    Why did I have to write it myself?

    Does it come standard in some library (package)
    in Python or (Gauche)Scheme?

    ________________

    A few weeks ago, i was curious to see What English words contained (
    abcd... ) consecutive letters of the alphabet.

    defrag defg
    defang defg
    defog defg

    hijack hijk

    ________________________________(Is there such a word containing 5
    letters? )



    Am i too Abced-minded ????
    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From richard@richard@cogsci.ed.ac.uk (Richard Tobin) to rec.puzzles,comp.lang.lisp,comp.lang.python on Sun Feb 16 00:18:32 2025
    From Newsgroup: comp.lang.python

    In article <7513d4f4cf89bfd31edda3eb5ed84052@www.novabbs.com>,
    HenHanna <HenHanna@dev.null> wrote:

    A few weeks ago, i was curious to see What English words contained ( >abcd... ) consecutive letters of the alphabet.

    defrag defg
    defang defg
    defog defg

    hijack hijk

    ________________________________(Is there such a word containing 5
    letters? )

    $ awk 'BEGIN {for(i=97; i<=118; i++) printf("%c.*%c.*%c.*%c.*%c\n", i, i+1, i+2, i+3, i+4);}' | while read e; do grep -i $e /usr/share/dict/words; done

    -- Richard


    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From Paul Rubin@no.email@nospam.invalid to rec.puzzles,comp.lang.lisp,comp.lang.python on Sat Feb 15 23:43:10 2025
    From Newsgroup: comp.lang.python

    richard@cogsci.ed.ac.uk (Richard Tobin) writes:
    $ awk 'BEGIN {for(i=97; i<=118; i++) printf("%c.*%c.*%c.*%c.*%c\n", i,
    i+1, i+2, i+3, i+4);}' | while read e; do grep -i $e
    /usr/share/dict/words; done

    Nice! That picked up "Kilimanjaro" which my more complicated Python
    script missed, because it didn't case-fold.
    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From HenHanna@HenHanna@dev.null to rec.puzzles,comp.lang.lisp,comp.lang.python on Sun Feb 16 13:37:11 2025
    From Newsgroup: comp.lang.python

    On Sun, 16 Feb 2025 7:43:10 +0000, Paul Rubin wrote:

    richard@cogsci.ed.ac.uk (Richard Tobin) writes:
    $ awk 'BEGIN {for(i=97; i<=118; i++) printf("%c.*%c.*%c.*%c.*%c\n", i,
    i+1, i+2, i+3, i+4);}' | while read e; do grep -i $e
    /usr/share/dict/words; done

    Nice! That picked up "Kilimanjaro" which my more complicated Python
    script missed, because it didn't case-fold.


    ___________How about alphabetically backwards?


    eponym ponm

    gifted gfed


    __________ short Python program for Subseq (with & without using
    RE) ?
    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From richard@richard@cogsci.ed.ac.uk (Richard Tobin) to rec.puzzles,comp.lang.lisp,comp.lang.python on Sun Feb 16 19:02:35 2025
    From Newsgroup: comp.lang.python

    In article <87v7tabai9.fsf@nightsong.com>,
    Paul Rubin <no.email@nospam.invalid> wrote:

    $ awk 'BEGIN {for(i=97; i<=118; i++) printf("%c.*%c.*%c.*%c.*%c\n", i,
    i+1, i+2, i+3, i+4);}' | while read e; do grep -i $e
    /usr/share/dict/words; done

    Nice! That picked up "Kilimanjaro" which my more complicated Python
    script missed, because it didn't case-fold.

    Or, closer to (my) home, "Kilmarnock".

    -- Richard
    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From Carl G.@carlgnews@microprizes.com to rec.puzzles,comp.lang.lisp,comp.lang.python on Sun Feb 16 11:44:16 2025
    From Newsgroup: comp.lang.python

    On 2/15/2025 1:36 PM, HenHanna wrote:
    The Substring function  is a nice Programming puzzle.

               Why did I have to write it myself?

                         Does it come standard in some library (package)
                           in Python or (Gauche)Scheme?

    ________________

    A few weeks ago,  i was curious to see What English words contained  ( abcd...  )  consecutive letters of the alphabet.

            defrag          defg
            defang          defg
            defog           defg

            hijack          hijk

    ________________________________(Is there such a word containing 5
    letters? )



                Am i  too Abced-minded ????

    The letters of my last name ("GINNOW") are in alphabetical order (but
    they are not all consecutive, just "NO"). Can you find any well-known
    names in which all of the letters are in alphabetical order (not
    necessarily consecutive)?

    My first name is "CARL". If I had been named "ABE", my first and last
    name together would have alphabetical letters. Can you find any
    well-known names in which the first and last name together is alphabetical?
    --
    Carl G.


    --
    This email has been checked for viruses by AVG antivirus software.
    www.avg.com
    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From HenHanna@HenHanna@dev.null to rec.puzzles,comp.lang.lisp,comp.lang.python on Mon Feb 17 11:50:35 2025
    From Newsgroup: comp.lang.python

    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!
    --- Synchronet 3.20c-Linux NewsLink 1.2
  • From B. Pym@Nobody447095@here-nor-there.org to rec.puzzles,comp.lang.lisp,comp.lang.python on Fri Jun 6 15:17:16 2025
    From Newsgroup: comp.lang.python

    HenHanna wrote:

    A few weeks ago, i was curious to see What English words contained
    ( abcd... ) consecutive letters of the alphabet.

    defrag defg
    defang defg
    defog defg

    hijack hijk

    ________________________________(Is there such a word containing 5
    letters? )

    Gauche Scheme

    (define (foo n-list)
    (define temp '())
    (values
    (remove
    (lambda (n)
    (and (or (null? temp) (member (- n (car temp)) '(0 1)))
    (push! temp n)))
    n-list)
    (length (delete-duplicates temp))))

    (define (max-seq-length str)
    (let go ((codes (map char->integer (map char-upcase (string->list str))))
    (best 0))
    (if (null? codes)
    best
    (receive (codes n) (foo codes)
    (go codes (max n best))))))

    (use file.util) ;; file->string-list

    (dolist (word (file->string-list "words"))
    (let ((len (max-seq-length word)))
    (when (> len 4)
    (print (list word len)))))

    ===>
    (aborticide 5)
    (absconder 5)
    (abscondment 5)
    (abstractedness 5)
    (ambuscade 5)
    (kilimanjaro 5)
    (limnocryptes 5)
    (reconstructive 5)

    --- Synchronet 3.21a-Linux NewsLink 1.2