Re: write simpler a syntax form ?

Damien Mattei <[email protected]>
Newsgroups gmane.lisp.guile.user
Message-ID <CADEOadfi5WPCy2aKnOc-6h39AmvAxpnTFL-Dkypb6ZV1=8WzHA@mail.gmail.com>
note that this simplification works:

(cons #'list
         (optimizer-parse-square-brackets-arguments-lister-syntax
#`(#,@#'args-brackets)))))

but all attempt to simplify this part: #`(#,@#'args-brackets)
gives errors


On Thu, May 16, 2024 at 1:00 AM Damien Mattei <[email protected]>
wrote:

> do you think this can be written simpler?
>
> #`(list #,@(optimizer-parse-square-brackets-arguments-lister-syntax
> #`(#,@#'args-brackets)))
>
> i'm quite afraid the look the 'syntax' get....
>
> it is part of this macro:
>
> (define-syntax $bracket-apply$
>
>   (lambda (stx)
>
>     (syntax-case stx ()
>
>
>       ;; a version that pre-compil the infix expression, should be faster
>       ;; scheme@(guile-user)> {#(1 2 3 4 5 6 7 8 9)[6 - 4 : 5 + 2]}
>       ;; optimizer-parse-square-brackets-arguments-lister-syntax : args-brackets=(#<syntax:unknown file:2:22 6> #<syntax:unknown file:2:24 -> #<syntax:unknown file:2:26 4> #<syntax:unknown file:2:28 :> #<syntax:unknown file:2:30 5> #<syntax:unknown file:2:32 +> #<syntax:unknown file:2:34 2>)
>       ;; $bracket-apply$ : #'parsed-args=(#<syntax:apply-square-brackets.scm:106:37 list> (#<syntax:unknown file:2:24 -> #<syntax:unknown file:2:22 6> #<syntax:unknown file:2:26 4>) #<syntax:unknown file:2:28 :> (#<syntax:unknown file:2:32 +> #<syntax:unknown file:2:30 5> #<syntax:unknown file:2:34 2>))
>       ;; $1 = #(3 4 5 6 7)
>
>       ;; scheme@(guile-user)> (define i 5)
>       ;; scheme@(guile-user)> {#(1 2 3 4 5 6 7 8 9)[6 - 4 : i + 2]}
>       ;; optimizer-parse-square-brackets-arguments-lister-syntax : args-brackets=(#<syntax:unknown file:4:22 6> #<syntax:unknown file:4:24 -> #<syntax:unknown file:4:26 4> #<syntax:unknown file:4:28 :> #<syntax:unknown file:4:30 i> #<syntax:unknown file:4:32 +> #<syntax:unknown file:4:34 2>)
>       ;; $bracket-apply$ : #'parsed-args=(#<syntax:apply-square-brackets.scm:106:37 list> (#<syntax:unknown file:4:24 -> #<syntax:unknown file:4:22 6> #<syntax:unknown file:4:26 4>) #<syntax:unknown file:4:28 :> (#<syntax:unknown file:4:32 +> #<syntax:unknown file:4:30 i> #<syntax:unknown file:4:34 2>))
>       ;; $2 = #(3 4 5 6 7)
>       (($bracket-apply$ container . args-brackets)
>
>
>        (with-syntax ((parsed-args #`(list #,@(optimizer-parse-square-brackets-arguments-lister-syntax #`(#,@#'args-brackets)))))	
> 		
> 		    (display "$bracket-apply$ : #'parsed-args=") (display #'parsed-args) (newline)
> 		
> 		    #'($bracket-apply$next4list-args container parsed-args))))))
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.