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 <20240703065204.66@kylheku.com>
Deutsch   English   Français   Italiano  
<20240703065204.66@kylheku.com>

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

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.lang.lisp
Subject: Re: CL vs scheme macros, namespaces.
Date: Wed, 3 Jul 2024 14:10:10 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 63
Message-ID: <20240703065204.66@kylheku.com>
References: <v63edt$2637i$1@dont-email.me>
Injection-Date: Wed, 03 Jul 2024 16:10:10 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="30e244ac737476d78edd2cd6194d0a15";
	logging-data="2332223"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19Vty8dS1SungXbXB3dTFz9W80OnbyMZ9A="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:7zoc2mw4R322h3rB0PxodjGicro=
Bytes: 2555

On 2024-07-03, B. Pym <No_spamming@noWhere_7073.org> wrote:
> The helper macro isn't needed.
>
> Scheme (Gauche and Racket):
>
> The goal is a let-macro that doesn't need parentheses
> around the bindings.  Only one expression is allowed
> after the bindings.
>
> (define-syntax -->
>   (syntax-rules ()
>     [ (_  ((k v) ...) expr)
>       (let ((k v) ...) expr) ]
>     [ (_  ((k v) ...) a b  . more)
>       (--> ((k v) ... (a b))  . more) ]
>     [ (_  a b c more ...)
>       (--> () a b c more ...) ]))

That's stupid; just make it so the wrapping is not allowed,
rather than optional:

(defmacro flat (. bindings-and-expr)
  (tree-case bindings-and-expr
     ((expr) expr)
     ((k v . rest) ^(let ((,k ,v)) (flat ,*rest)))
     (x (error "flat: bad syntax"))))

2> (flat 3)
3
3> (flat x 1 x)
1
4> (flat x 1 y 2 (+ x y))
3
5> (flat x 1 y 2 4 (+ x y))
** flat: bad syntax
** during evaluation at expr-1:6 of form (error "flat: bad syntax")
5> (flat x 1)
** flat: bad syntax
** during evaluation at expr-1:6 of form (error "flat: bad syntax")
5> (flat)
** flat: bad syntax
** during evaluation at expr-1:6 of form (error "flat: bad syntax")

> (--> a 2 m 44 z 88 (print (list a m z)))
>  ===>
> (2 44 88)
>
> (--> a 2 m 44 z 88 )
>  ===>
> ; stdin:10:0: -->: bad syntax
> ;   in: (--> ((a 2) (m 44) (z 88)))

Wut? Your diagnostic is reported against something that the
user didn't write, because it got normalized into
the nested let-style syntax, which is supposd to be
further processed.

What is the point.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca