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 : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : rec.puzzles comp.lang.lisp comp.lang.python
Date : 06. Jun 2025, 16:17:16
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <101v0pr$2bdk8$1@dont-email.me>
References : 1
User-Agent : XanaNews/1.18.1.6
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)


Date Sujet#  Auteur
15 Feb 25 * ( Substring function in Python, Lisp) -- [Hijack] contains [hijk]8HenHanna
16 Feb 25 +* Re: ( Substring function in Python, Lisp) -- [Hijack] contains [hijk]4Richard Tobin
16 Feb 25 i`* Re: ( Substring function in Python, Lisp) -- [Hijack] contains [hijk]3Paul Rubin
16 Feb 25 i +- Re: ( Substring function in Python, Lisp) -- [Hijack] contains [hijk]1HenHanna
16 Feb 25 i `- Re: ( Substring function in Python, Lisp) -- [Hijack] contains [hijk]1Richard Tobin
16 Feb 25 +- Re: ( Substring function in Python, Lisp) -- [Hijack] contains [hijk]1Carl G.
17 Feb 25 +- Re: ( Substring function in Python, Lisp) -- [Hijack] contains [hijk]1HenHanna
6 Jun16:17 `- Re: ( Substring function in Python, Lisp) -- [Hijack] contains [hijk]1B. Pym

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal