Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <v67puc$34oek$1@dont-email.me>
Deutsch   English   Français   Italiano  
<v67puc$34oek$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: "B. Pym" <No_spamming@noWhere_7073.org>
Newsgroups: comp.lang.lisp
Subject: Re: Extended loop macro
Date: Fri, 5 Jul 2024 03:40:01 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 58
Message-ID: <v67puc$34oek$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Fri, 05 Jul 2024 05:40:01 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="11bd25c943d4777aa7993dde8ec0a313";
	logging-data="3301844"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/T9NvVJLW/oDhZ03VpzSSq"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:FYWTbWtWujdwxCfsNLpkAJm+7i0=
Bytes: 2212

Antonio Menezes Leitao wrote:

> Edi Weitz <spamt...@agharta.de> writes: 
> > (loop with scheme-char-seen-p = nil 
> >       for c across string 
> >       when (or (char-not-greaterp #\a c #\z) 
> >                (digit-char-p c) 
> >                (member c '(#\+ #\- #\.) :test #'char=)) 
> >         do (setq scheme-char-seen-p t) 
> >       else return (and scheme-char-seen-p 
> >                        (char= c #\:))) 
> 
> Lot's of extremely nice examples!  And the last one even ends with a 
> smile.  I hope you can see it! 
> 
> Thanks a lot,

In other words, test whether the string begins with a
sequence composed of a-z, 0-9, or [.+-], followed
by ":".

"char-not-greaterp" looks like a joke, doesn't it?
If you think it's Intercal, but it's not, it's
Common Lisp.

The easiest way would be to use regular expressions.
Let's do it a harder way.

Gauche Scheme

(use srfi-13) ;; string functions
(use srfi-14) ;; character sets

(define ch-set
  (char-set-union 
    char-set:lower-case
    char-set:digit
    (string->char-set ".+-")))

(define (foo str)
  (let ((i (string-index str (char-set-complement ch-set)))
        (j (string-index str #\:)))
    (and i j (> i 0) (= i j))))

(foo " hello")
#f

(foo "hello")
#f

(foo ": hello")
#f

(foo "abc: hello")
#t

(foo ".+-: hello")
#t