<div>Give '{' yada '}' definable language semantics in the sense of #lang yada.</div><div><br></div><div>Similar to SML-NJ Quote/Antiquote but leveraging Rackets more robust built-in language support.</div>
<div><br></div><div>So a source file could be.</div><div><br></div><div>==========</div><div>#lang racket</div><div>#lang {{ formula }}</div><div><br></div><div>(define x 3)</div><div>(define y 2)</div><div><br></div><div>
(define z {{ log (x + y) }}) </div><div><br></div><div>#lang {{ datalog }} ;; switch datalog language</div><div><br></div><div>(define result {{</div><div><table cellspacing="0" class="RktBlk" style="font-family:serif;background-color:rgb(255,255,255)">
<tbody><tr><td style="padding-left:0px;padding-right:0px;vertical-align:baseline"><font face="arial, helvetica, sans-serif"><span class="RktMeta"></span><span class="RktMeta"> ancestor</span><span class="RktPn" style="color:rgb(132,60,36)">(</span><span class="RktMeta">A</span><span class="RktPn" style="color:rgb(132,60,36)">,</span><span class="RktMeta"></span><span class="hspace"> </span><span class="RktMeta"></span><span class="RktMeta">B</span><span class="RktPn" style="color:rgb(132,60,36)">)</span><span class="RktMeta"></span><span class="hspace"> </span><span class="RktMeta"></span><span class="RktPn" style="color:rgb(132,60,36)">:-</span><span class="RktMeta"></span><span class="hspace"> </span><span class="RktMeta"></span><span class="RktMeta">parent</span><span class="RktPn" style="color:rgb(132,60,36)">(</span><span class="RktMeta">A</span><span class="RktPn" style="color:rgb(132,60,36)">,</span><span class="RktMeta"></span><span class="hspace"> </span><span class="RktMeta"></span><span class="RktMeta">B</span><span class="RktPn" style="color:rgb(132,60,36)">)</span><span class="RktPn" style="color:rgb(132,60,36)">.</span><span class="RktMeta"></span></font></td>
</tr><tr><td style="padding-left:0px;padding-right:0px;vertical-align:baseline"><font face="arial, helvetica, sans-serif"><span class="RktMeta"></span><span class="RktMeta"> ancestor</span><span class="RktPn" style="color:rgb(132,60,36)">(</span><span class="RktMeta">A</span><span class="RktPn" style="color:rgb(132,60,36)">,</span><span class="RktMeta"></span><span class="hspace"> </span><span class="RktMeta"></span><span class="RktMeta">B</span><span class="RktPn" style="color:rgb(132,60,36)">)</span><span class="RktMeta"></span><span class="hspace"> </span><span class="RktMeta"></span><span class="RktPn" style="color:rgb(132,60,36)">:-</span><span class="RktMeta"></span></font></td>
</tr><tr><td style="padding-left:0px;padding-right:0px;vertical-align:baseline"><font face="arial, helvetica, sans-serif"><span class="RktMeta"></span><span class="hspace"> </span><span class="RktMeta"></span><span class="RktMeta">parent</span><span class="RktPn" style="color:rgb(132,60,36)">(</span><span class="RktMeta">A</span><span class="RktPn" style="color:rgb(132,60,36)">,</span><span class="RktMeta"></span><span class="hspace"> </span><span class="RktMeta"></span><span class="RktMeta">C</span><span class="RktPn" style="color:rgb(132,60,36)">)</span><span class="RktPn" style="color:rgb(132,60,36)">,</span><span class="RktMeta"></span><span class="hspace"> </span><span class="RktMeta"></span><span class="RktMeta">D</span><span class="RktMeta"></span><span class="hspace"> </span><span class="RktMeta"></span><span class="RktPn" style="color:rgb(132,60,36)">=</span><span class="RktMeta"></span><span class="hspace"> </span><span class="RktMeta"></span><span class="RktMeta">C</span><span class="RktPn" style="color:rgb(132,60,36)">,</span><span class="RktMeta"></span><span class="hspace"> </span><span class="RktMeta"></span><span class="RktMeta">ancestor</span><span class="RktPn" style="color:rgb(132,60,36)">(</span><span class="RktMeta">D</span><span class="RktPn" style="color:rgb(132,60,36)">,</span><span class="RktMeta"></span><span class="hspace"> </span><span class="RktMeta"></span><span class="RktMeta">B</span><span class="RktPn" style="color:rgb(132,60,36)">)</span><span class="RktPn" style="color:rgb(132,60,36)">.</span><span class="RktMeta"></span></font></td>
</tr><tr><td style="padding-left:0px;padding-right:0px;vertical-align:baseline"><font face="arial, helvetica, sans-serif"><span class="RktMeta"></span><span class="RktMeta"> parent</span><span class="RktPn" style="color:rgb(132,60,36)">(</span><span class="RktMeta">john</span><span class="RktPn" style="color:rgb(132,60,36)">,</span><span class="RktMeta"></span><span class="hspace"> </span><span class="RktMeta"></span><span class="RktMeta">douglas</span><span class="RktPn" style="color:rgb(132,60,36)">)</span><span class="RktPn" style="color:rgb(132,60,36)">.</span><span class="RktMeta"></span></font></td>
</tr><tr><td style="padding-left:0px;padding-right:0px;vertical-align:baseline"><font face="arial, helvetica, sans-serif"><span class="RktMeta"></span><span class="RktMeta"> parent</span><span class="RktPn" style="color:rgb(132,60,36)">(</span><span class="RktMeta">bob</span><span class="RktPn" style="color:rgb(132,60,36)">,</span><span class="RktMeta"></span><span class="hspace"> </span><span class="RktMeta"></span><span class="RktMeta">john</span><span class="RktPn" style="color:rgb(132,60,36)">)</span><span class="RktPn" style="color:rgb(132,60,36)">.</span><span class="RktMeta"></span></font></td>
</tr><tr><td style="padding-left:0px;padding-right:0px;vertical-align:baseline"><font face="arial, helvetica, sans-serif"><span class="RktMeta"></span><span class="RktMeta"> ancestor</span><span class="RktPn" style="color:rgb(132,60,36)">(</span><span class="RktMeta">A</span><span class="RktPn" style="color:rgb(132,60,36)">,</span><span class="RktMeta"></span><span class="hspace"> </span><span class="RktMeta"></span><span class="RktMeta">B</span><span class="RktPn" style="color:rgb(132,60,36)">)</span><span class="RktPn" style="color:rgb(132,60,36)">?<br>
</span></font><span style="background-color:transparent">}} )<br><br>#lang {{ formula }} ;; back to math formula<br><br>(define ans (some-procedure result {{ z^2 + 42 }}))</span></td></tr></tbody></table></div><div>=======</div>
<div><br></div><div>just works.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><br><br><div class="gmail_quote">On Thu, May 10, 2012 at 4:44 PM, John Clements <span dir="ltr"><<a href="mailto:clements@brinckerhoff.org" target="_blank">clements@brinckerhoff.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On May 10, 2012, at 1:00 PM, Matthias Felleisen wrote:<br>
<br>
><br>
> I will assert something about readability:<br>
><br>
> Racket programs look heavy when compared with Haskell programs.<br>
><br>
> This is probably true for Python instead of Haskell, too. It is also true for ML. I conjecture that part of that heaviness comes from wide lines, long names, deep nesting. Who knows. I don't even know how to measure this kind of property.<br>
><br>
> At this point, I can express certain ideas more easily in Racket than in Haskell, Python, ML or whatever, which is why I am fine. But if this advantage ever disappeared, heaviness would definitely be a factor to weigh.<br>
<br>
</div>+1<br>
<span class="HOEnZb"><font color="#888888"><br>
John<br>
<br>
</font></span><br>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br>