From: Damien Mattei <damien.mattei@gmail.com>
To: guile-user <guile-user@gnu.org>
Subject: write simpler a syntax form ?
Date: Thu, 16 May 2024 01:00:58 +0200 [thread overview]
Message-ID: <CADEOadeDAY9Xf3e+oq8z+iUsyRw9Sc1bB72ENJMYhqpq5VfrrQ@mail.gmail.com> (raw)
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))))))
next reply other threads:[~2024-05-15 23:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-15 23:00 Damien Mattei [this message]
2024-05-16 5:51 ` write simpler a syntax form ? Damien Mattei
2024-05-24 13:08 ` Jean Abou Samra
2024-05-25 14:12 ` Damien Mattei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CADEOadeDAY9Xf3e+oq8z+iUsyRw9Sc1bB72ENJMYhqpq5VfrrQ@mail.gmail.com \
--to=damien.mattei@gmail.com \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).