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


Groups > comp.lang.python > #197503

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

Path csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From "B. Pym" <Nobody447095@here-nor-there.org>
Newsgroups rec.puzzles, comp.lang.lisp, comp.lang.python
Subject Re: ( Substring function in Python, Lisp) -- [Hijack] contains [hijk]
Date Fri, 6 Jun 2025 15:17:16 -0000 (UTC)
Organization A noiseless patient Spider
Lines 51
Message-ID <101v0pr$2bdk8$1@dont-email.me> (permalink)
References <7513d4f4cf89bfd31edda3eb5ed84052@www.novabbs.com>
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Injection-Date Fri, 06 Jun 2025 17:17:17 +0200 (CEST)
Injection-Info dont-email.me; posting-host="d9eb446f1c0856427392eb536decbcd7"; logging-data="2471560"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19tUc7LCF/D9HVdmZ8G5I1u"
User-Agent XanaNews/1.18.1.6
Cancel-Lock sha1:c0lAGb7geKvtrqxdBkIfuuWv8I4=
Xref csiph.com rec.puzzles:26690 comp.lang.lisp:60321 comp.lang.python:197503

Cross-posted to 3 groups.

Show key headers only | View raw


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)

Back to comp.lang.python | Previous | NextPrevious 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