On Sun, Sep 25, 2016 at 01:50:51PM -0700, Dupéron Georges wrote:
If I understand you well, the intended use of your nested delimiters can be 
more or less described as syntactic sugar for #reader, with auto-detection of 
where the string ends:

(filter foo?
       (python-ish-list-comprehend
        «thing for x in sqlish(«select * from foo») where some_pred(x)»))

could be rewritten as:

(filter foo?
       #reader"python-ish-list-comprehend.rkt" thing for x in #reader"sqlish.rkt" select * 
from foo<READER 2 STOPS HERE> where some_pred(x)<READER 1 STOPS HERE>


That seems like a very reasonable way of looking at it I it.

Here is a little step through of what my rash macro does:

(define pwd-var "pwd")
(rash «ls $(rash/trim «dirname $(rash/trim «$pwd-var»)»)»)

;; after one step of expansion, this looks something like this:
(rash-line-parse 'ls (rash/trim «dirname $(rash/trim «$pwd-var»)»))
;; rash-line-parse would expand to (run-pipeline ...) or (begin ...) if
;; there were multiple lines, but if we pretend that the inner macro
;; would expand first, it would be
(rash-line-parse 'ls (<surrounding-stuff-that-differentiates-rash/out-from-rash>
                     (rash-line-parse 'dirname (rash/trim «$pwd-var»))))
;; then
(rash-line-parse 'ls (<surrounding-stuff>
                     (rash-line-parse 'dirname
                                      (<surrounding-stuff>
                                       ;; the $ in rash keeps pwd-var from 
being quoted
                                       (rash-line-parse pwd-var)))))

So each rash macro reads another layer of string (each one needing a $
due to the syntax specifics of the rash language), but nested strings
will still become strings after applying the reader again, while other
things will become symbols, s-expressions...  So you could also use \"
and \\" instead of «», «» is just nicer.

So it is very much like your #reader example above.

William

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to