In a future version of what I am working on I see regex being an excellent 
solution.  My search is against a file I load into a list at program 
initialization.  However for other parts of this to load a list based on a 
partial file filtered with regex may be a better solution.

There is also the case that I eventually switch to a DB backend, but at 
prototype stage I have been skipping that.

Sorry not an answer to your query, but I think I could make use of the answer 
so inserting myself into the thread.

Ken

On Friday, October 28, 2016 at 3:18:14 PM UTC-4, David K. Storrs wrote:
> tl;dr :  Why is the following an error?
> 
> #lang at-exp racket
> (define a "this")
> @pregexp{^@a}  ;; Should produce #px"^this" but errors out
> @pregexp{@(~a "^" a)}  ;; This works but is clumsy
> 
> Long version:
> 
> The at-exp language
> (http://www.greghendershott.com/2015/08/at-expressions.html and
> https://docs.racket-lang.org/scribble/reader-internals.html) allows
> for (among other things) more convenient construction of regexen, like
> so:
> 
> (pregexp "\\d\\d\\.\\d\\d") ;; base racket. Ugh.
> @pregexp{\d\d\.\d\d}      ;; at-exp...ah, much better
> 
> I started to reply to Ken MacKenzie's recent post about string
> prefixes with a suggestion that, although string-prefix was what he
> wanted in this case, a regex would be a more general solution.  When I
> went to test the code I was suggesting, I was surprised to find it
> didn't work as expected.  I thought maybe "^@" was a function or
> special form in Racket, but a quick search of the docs revealed
> nothing.  I tried various forms of quoting inside the at-exp but
> nothing worked.
> 
> What am I missing?

-- 
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