Re: [racket-users] splicing conditional results in the surrounding block?

2016-02-13 Thread Eli Barzilay
On Fri, Feb 12, 2016 at 10:45 PM, Nota Poin wrote: > > at-exp really is a fascinating language, It's not a language in itself, it's a meta-language, which modifies the actual language with the @-form syntax. > but if a (flatten) isn't any more computationally expensive, you

Re: [racket-users] splicing conditional results in the surrounding block?

2016-02-12 Thread Nota Poin
On Thursday, February 11, 2016 at 12:29:04 PM UTC, Neil Van Dyke wrote: > http://www.neilvandyke.org/racket-html-template/ This does almost exactly what I was thinking about! Looking at the code makes me go cross-eyed, but if you (expand-once #'(html-template ...)) enough, it turns the SXML

Re: [racket-users] splicing conditional results in the surrounding block?

2016-02-12 Thread Neil Van Dyke
Nota Poin wrote on 02/12/2016 10:41 PM: This does almost exactly what I was thinking about! Looking at the code makes me go cross-eyed, Yes, I recommend not looking at the code. IIRC, the code is a little icky for a few reasons: 1. It was initially not as clear as I like, just because of

Re: [racket-users] splicing conditional results in the surrounding block?

2016-02-12 Thread Nota Poin
On Friday, February 12, 2016 at 1:26:05 AM UTC, Matthew Butterick wrote: > Of course, you can also use the `at-exp` metalanguage from Scribble to > simplify text-heavy constructions like these, with variables interpolated > into strings: > #lang at-exp racket > > (define (query condA condB

[racket-users] splicing conditional results in the surrounding block?

2016-02-11 Thread Nota Poin
I run into this problem a lot whenever I'm generating some text. I'll be making what amounts to a sequence of strings being appended, and do something like this: (apply string-append (list "" something "")) Compared to un-parsing a representation of a document tree every single time,

Re: [racket-users] splicing conditional results in the surrounding block?

2016-02-11 Thread Nota Poin
On Thursday, February 11, 2016 at 9:08:33 AM UTC-8, Matthew Butterick wrote: > I'm supposing you know that Racket has at least two native representations > (X-expression and SXML) for HTML-like structures, so hacking HTML tags by > hand is unnecessary. Yes, thank you for mentioning them. I was

Re: [racket-users] splicing conditional results in the surrounding block?

2016-02-11 Thread Neil Van Dyke
Nota Poin wrote on 02/11/2016 04:48 AM: But there's no way I've ever been able to figure to produce generated text that is just a flat list of strings, if I ever want to have conditional decisions about what to go in that list. You might like `quasiquote` and `unquote-splicing`: `("a" "b"

Re: [racket-users] splicing conditional results in the surrounding block?

2016-02-11 Thread Matthew Butterick
> Yes, thank you for mentioning them. I was actually thinking of starting with > SXML, but then turning it into a list of string fragments (with spaces left > for the dynamically generated parts) as a simplification step once I've > figured out where everything goes. But there are other

Re: [racket-users] splicing conditional results in the surrounding block?

2016-02-11 Thread Matthew Butterick
> Nota Poin wrote on 02/11/2016 04:48 AM: >> But there's no way I've ever been able to figure to produce generated text >> that is just a flat list of strings, if I ever want to have conditional >> decisions about what to go in that list. I'm supposing you know that Racket has at least two