<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2080885971644496896</id><updated>2012-02-07T08:08:25.739-05:00</updated><category term='units'/><category term='xml'/><category term='structure properties'/><category term='futures'/><category term='web-server'/><category term='threads'/><category term='racketcon'/><category term='planet'/><category term='documentation'/><category term='contracts'/><category term='matthew'/><category term='keybindings'/><category term='macros'/><category term='continuations'/><category term='serialization'/><category term='drscheme'/><category term='typed-scheme'/><category term='scribble'/><category term='channels'/><category term='delimited continuations'/><category term='check syntax'/><category term='set'/><category term='interview'/><category term='tutorials'/><category term='self-reference'/><category term='script'/><category term='parallelism'/><category term='experience-reports'/><category term='scheme video'/><category term='oopsla'/><category term='release'/><category term='academic'/><category term='papers'/><category term='soft state'/><category term='industrial'/><title type='text'>The Racket Blog</title><subtitle type='html'>News, insights, tutorials, and more from the PLT team behind the Racket language.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Jens Axel Søgaard</name><uri>http://www.blogger.com/profile/15211030864341077735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>85</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-2390508687802287055</id><published>2012-02-02T15:30:00.001-05:00</published><updated>2012-02-02T15:30:51.437-05:00</updated><title type='text'>Racket v5.2.1</title><content type='html'>Racket version 5.2.1 is now available from
&lt;pre&gt;&lt;a href="http://racket-lang.org/"&gt;http://racket-lang.org/&lt;/a&gt;&lt;/pre&gt;
&lt;h2&gt;Release Highlights:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Performance improvements include the use of &lt;tt&gt;epoll()&lt;/tt&gt;/&lt;tt&gt;kqueue()&lt;/tt&gt; instead of &lt;tt&gt;select()&lt;/tt&gt; for the Racket thread scheduler, cross-module inlining of small functions, and the use of SSE instead of x87 for JIT-compiled floating-point operations on platforms where SSE is always available (including x86_64 platforms).  A related change is the interning of literal numbers, strings, byte strings, characters, and regexps that appear in code and syntax objects.&lt;/li&gt;
&lt;li&gt;DrRacket uses a set of composable ray-traced icons available from the new &lt;tt&gt;images&lt;/tt&gt; library collection.&lt;/li&gt;
&lt;li&gt;Typed Racket's &lt;tt&gt;typecheck-fail&lt;/tt&gt; form allows macro creators to customize the error messages that Typed Racket produces.  This is especially useful when creating pattern matching macros.&lt;/li&gt;
&lt;li&gt;The performance of Redex's matcher has been substantially improved; depending on the model you should see improvements between 2x and 50x in the time it takes to reduce terms.&lt;/li&gt;
&lt;li&gt;Plots look nicer and are more correct at very small and very large scales.  New features include customizable dual axis ticks and transforms (e.g., log axes, date and currency ticks, axis interval collapse and stretch), stacked histograms, and 3D vector fields.  The legacy &lt;tt&gt;fit&lt;/tt&gt; function and libfit have been removed.&lt;/li&gt;
&lt;li&gt;The &lt;tt&gt;2htdp/universe&lt;/tt&gt; library's &lt;tt&gt;big-bang&lt;/tt&gt; form supports an experimental game pad key handler.&lt;/li&gt;
&lt;li&gt;The &lt;tt&gt;db&lt;/tt&gt; library now supports nested transactions and PostgreSQL arrays.  Bugs involving MySQL authentication and memory corruption in the SQLite bindings have been fixed.&lt;/li&gt;
&lt;li&gt;The Macro Stepper tool in DrRacket no longer executes a program after expanding it.&lt;/li&gt;
&lt;li&gt;In the DMdA teaching languages, infinite recursive signatures ("streams", for example) with no intervening &lt;tt&gt;mixed&lt;/tt&gt; are now supported, and the signatures of record definitions without fields now have generators for use with &lt;tt&gt;property&lt;/tt&gt;.&lt;/li&gt;
&lt;li&gt;MysterX's ActiveX support is deprecated and will be removed in the next release.  MysterX's core COM functionality will become deprecated in the next release, but COM functionality will be supported for the foreseeable future as a compatibility layer over a forthcoming &lt;tt&gt;ffi/com&lt;/tt&gt; library.&lt;/li&gt;
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-2390508687802287055?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/2390508687802287055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=2390508687802287055' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2390508687802287055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2390508687802287055'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2012/02/racket-v521.html' title='&lt;a href=&quot;http://racket-lang.org&quot;&gt;Racket v5.2.1&lt;/a&gt;'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/04250857957616050612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://3.bp.blogspot.com/-YI1Vg8itdSQ/Trtea3cqYQI/AAAAAAAAACA/eHNhhe5FSLM/s220/eli-small.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-2611538924601880099</id><published>2012-02-01T19:25:00.000-05:00</published><updated>2012-02-01T21:46:59.560-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='serialization'/><category scheme='http://www.blogger.com/atom/ns#' term='web-server'/><category scheme='http://www.blogger.com/atom/ns#' term='continuations'/><category scheme='http://www.blogger.com/atom/ns#' term='experience-reports'/><title type='text'>Zack Galler's Experience with Stateful vs Stateless Web Apps</title><content type='html'>&lt;p&gt;Communication using HTTP between client and server is a simple problem of halted computation.&lt;/p&gt;
&lt;p&gt;A client computes a request, transmits and halts, waiting for a server response.  On receipt, the server computes a response, transmits and halts, waiting for the next client request.&lt;/p&gt;
&lt;p&gt;This much is well known.&lt;/p&gt;
&lt;p&gt;Racket's magnificent &lt;em&gt;stateful&lt;/em&gt; Web server does three things on the server side:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;it &lt;b&gt;reifies&lt;/b&gt; a Racket continuation, capturing where the server computation has halted.&lt;/li&gt;
&lt;li&gt;it &lt;b&gt;externalizes&lt;/b&gt; the continuation, creating  a URL-representation that uniquely maps to the Racket continuation&lt;/li&gt;
&lt;li&gt;it &lt;b&gt;disseminates&lt;/b&gt; the externalized continuation to interested clients, typically via HTTP response, but alternately via SMTP or any other protocol.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Then, it waits.&lt;/p&gt;
&lt;p&gt;Later, when &lt;b&gt;presented&lt;/b&gt; with an externalized continuation, a quick inverse mapping occurs, the underlying Racket continuation is &lt;b&gt;invoked,&lt;/b&gt; and the server processes the new client request.&lt;/p&gt;
&lt;p&gt;Rinse and repeat.&lt;/p&gt;
&lt;p&gt;The problem with this approach is twofold&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;the reified Racket continuations live in server memory.  And there's no safe way to garbage collect, as the continuations could be invoked at any time.  There are strategies to reclaim memory, but &lt;em&gt;some&lt;/em&gt; load level will noticeably decrease the performance of your application.  And its not possible to figure out what that load level is prior to finishing your application.  This is a problem.&lt;/li&gt;
&lt;li&gt;Again, the reified Racket continuations live in server memory and cannot be moved.  So there's no way to scale an application to more than one server.  It's a necessarily one machine system.  This makes problem #1 worse.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Racket's yet more magnificent &lt;em&gt;stateless&lt;/em&gt; Web server does exactly the same three things:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;to &lt;b&gt;reify&lt;/b&gt;, it rewrites the entire call stack into a format known as &lt;a href="https://en.wikipedia.org/wiki/Administrative_normal_form"&gt;A-Normal Form&lt;/a&gt; (ANF).&lt;/li&gt;
&lt;li&gt;to &lt;b&gt;externalize&lt;/b&gt;, the ANF'd stack is encoded for transmission over HTTP.&lt;/li&gt;
&lt;li&gt;and then it's sent over to the client (&lt;b&gt;dissemination&lt;/b&gt;).&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Later, when &lt;b&gt;presented&lt;/b&gt; with encoded stack, the stateless server performs an inverse transform to &lt;b&gt;reconstruct&lt;/b&gt; the call stack, at which point the server keeps going.&lt;/p&gt;
&lt;p&gt;So we've lost the &lt;b&gt;invocation&lt;/b&gt; step and substituted a &lt;b&gt;reconstruction&lt;/b&gt;.&lt;/p&gt;
&lt;p&gt;But in exchange, we've eliminated continuations from server memory, and solved both enumerated problems above.  Neat trick.&lt;/p&gt;
&lt;br&gt;
&lt;p&gt;I provide a few lessons learned for the archives for the next person to attempt porting &lt;tt&gt;#lang racket&lt;/tt&gt; to &lt;tt&gt;#lang web-server&lt;/tt&gt; code.&lt;/p&gt;
&lt;p&gt;First, the predicate &lt;tt&gt;serializable?&lt;/tt&gt; from &lt;tt&gt;racket/serialize&lt;/tt&gt; is invaluable.  The &lt;tt&gt;#lang web-server&lt;/tt&gt; code will not transform if there are non-serializable constructs in the dynamic extent of the invocation of &lt;tt&gt;send/suspend&lt;/tt&gt;, such as a local binding or argument.&lt;/p&gt;
&lt;p&gt;Second, invocations of native continuations reified with &lt;tt&gt;call/cc&lt;/tt&gt; frequently throw errors related to continuation prompts, such as “attempt to cross a continuation barrier” or “no corresponding prompt tag in continuation”.  In all cases, I was able to remedy the situation by enclosing the invocation in &lt;tt&gt;call-with-continuation-prompt&lt;/tt&gt;.  This may be an error in the system, but it is unclear at this time.&lt;/p&gt;
&lt;p&gt;Third, the transformation does not allow parameters or &lt;tt&gt;dynamic-wind&lt;/tt&gt;, because the internal data-structures representing them are not serializable, but continuation-marks can be used to reimplement the piece of the functionality you need.&lt;/p&gt;
&lt;br&gt;
&lt;p&gt;Finally, thank you to the Racket team.  I think the stateless Web language is important technology and must have required an enormous amount of work to implement.&lt;/p&gt;
&lt;p&gt;Anecdotally, application speed seems at or better than the stateful code.&lt;/p&gt;
&lt;p&gt;To learn more about the stateless Web application infrastructure, &lt;a href="http://docs.racket-lang.org/web-server/stateless.html"&gt;consult the manual&lt;/a&gt; or post to the &lt;a href="http://lists.racket-lang.org/"&gt;mailing list&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;i&gt;(This post was written by Zack Galler with minor edits before posting by Jay McCarthy.)&lt;/i&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-2611538924601880099?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/2611538924601880099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=2611538924601880099' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2611538924601880099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2611538924601880099'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2012/02/zack-gallers-experience-with-stateful.html' title='Zack Galler&apos;s Experience with Stateful vs Stateless Web Apps'/><author><name>Jay McCarthy</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-13KUDv8LhZw/AAAAAAAAAAI/AAAAAAAAAAA/7MdiB5POU5k/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-453161652899215709</id><published>2011-11-09T22:49:00.000-05:00</published><updated>2011-11-09T22:49:08.917-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>Racket v5.2</title><content type='html'>Racket version 5.2 is now available from
&lt;pre&gt;&lt;a href="http://racket-lang.org/"&gt;http://racket-lang.org/&lt;/a&gt;&lt;/pre&gt;
&lt;h2&gt;Release Highlights:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;DrRacket comes with an experimental, on-line check syntax tool, although this new tool is disabled default.  See below for more information.&lt;/li&gt;
&lt;li&gt;The new &lt;tt&gt;db&lt;/tt&gt; library offers a high-level, functional interface to popular relational database systems, including PostgreSQL, MySQL, and SQLite, as well as other systems via ODBC.&lt;/li&gt;
&lt;li&gt;A new XREPL collection provides convenient commands for a plain racket REPL.  It is particularly convenient for people who prefer console-based work and alternative editors.  See also the new chapter on command-line tools and other editors at the end of the Racket Guide.&lt;/li&gt;
&lt;li&gt;The &lt;tt&gt;plot&lt;/tt&gt; collection has been reimplemented in Racket.  It now offers PDF output, log axes, histograms, and more.  Some code that uses &lt;tt&gt;plot&lt;/tt&gt; will still work, and some will need light porting.  The &lt;tt&gt;plot/compat&lt;/tt&gt; module offers expedient backward compatibility.&lt;/li&gt;
&lt;li&gt;DrRacket uses more conventional key bindings: &lt;tt&gt;C-t&lt;/tt&gt; creates a new tab, &lt;tt&gt;C-w&lt;/tt&gt; closes the current one, and &lt;tt&gt;C-r&lt;/tt&gt; runs the definitions.  On Mac OS X, the Command key is used.  See “Defining Custom Shortcuts” in the DrRacket manual for an example that uses the old key bindings.&lt;/li&gt;
&lt;li&gt;The new &lt;tt&gt;raco link&lt;/tt&gt; command registers a directory as a collection, which allows the collection directory to reside outside the “&lt;tt&gt;collects&lt;/tt&gt;” tree and without changing the PLTCOLLECTS environment variable.&lt;/li&gt;
&lt;li&gt;Typed Racket:&lt;ul&gt;
&lt;li&gt;Typed Racket provides static performance debugging support to show which code gets optimized and point out code that does not.  Use the “Performance Report” button in DrRacket.&lt;/li&gt;
&lt;li&gt;More intuitive types in printouts in the REPL and in error messages.  Use &lt;tt&gt;:query-result-type&lt;/tt&gt; to explore types, or &lt;tt&gt;:print-type&lt;/tt&gt; for a full printout.&lt;/li&gt;
&lt;li&gt;Typed Racket now supports defining function with optional arguments using the same syntax as Racket.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Redex now supports specifying (and testing and automatically typesetting) judgment forms including type systems and SOS-style operational semantics.&lt;/li&gt;
&lt;li&gt;Fixed several GUI problems, including problems on Ubuntu 11.10 (GTK+ 3) and 64-bit Mac OS X.&lt;/li&gt;
&lt;li&gt;Internal-definition expansion has changed to use &lt;tt&gt;let*&lt;/tt&gt; semantics for sequences that contain no back references.  This change removes a performance penalty for using internal definitions instead of &lt;tt&gt;let&lt;/tt&gt; in common cases, and it only changes the meaning of programs that capture continuations in internal definitions. Internal definitions are now considered preferable in style to &lt;tt&gt;let&lt;/tt&gt;.&lt;/li&gt;
&lt;li&gt;Support for &lt;tt&gt;begin-for-syntax&lt;/tt&gt; has been generalized; modules may now define and export both value bindings and syntax bindings (macros) at phase 1 and higher.
&lt;p&gt;&lt;small&gt;Due to a bug, phase 1 syntax (or higher) is not available in DrRacket's &lt;tt&gt;#lang&lt;/tt&gt;-based REPL.  A simple workaround is to disable debugging in DrRacket (see “no debugging” radio button in detailed language dialog).&lt;/small&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Additional Items:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;tt&gt;racket/gui&lt;/tt&gt; library (and Slideshow) provides more support for multiple-screen displays.&lt;/li&gt;
&lt;li&gt;DrRacket remembers whether an opened file used LF or CRLF line endings, and will continue using the same.  When creating a new file, a preference determines how it is saved.&lt;/li&gt;
&lt;li&gt;&lt;tt&gt;net/url&lt;/tt&gt; can now follow HTTP redirections.&lt;/li&gt;
&lt;li&gt;The LNCS and JFP class files are no longer distributed with Racket.  Instead, they are downloaded on demand.&lt;/li&gt;
&lt;li&gt;The Algol language implementation is now available as a plain language using &lt;tt&gt;#lang algol60&lt;/tt&gt;.&lt;/li&gt;
&lt;li&gt;The Racket-to-C compiler (as accessed via &lt;tt&gt;raco ctool&lt;/tt&gt; or &lt;tt&gt;mzc&lt;/tt&gt;) has been removed; Racket's JIT has long provided better performance, and the FFI provides better access to C libraries.&lt;/li&gt;
&lt;li&gt;Contracts can be applied to exports with the new &lt;tt&gt;contract-out&lt;/tt&gt; form within &lt;tt&gt;provide&lt;/tt&gt;, instead of a separate &lt;tt&gt;provide/contract&lt;/tt&gt; form.  (The new &lt;tt&gt;contract-out&lt;/tt&gt; form is implemented as a new kind of “provide pre-transformer”.)&lt;/li&gt;
&lt;li&gt;The &lt;tt&gt;date*&lt;/tt&gt; structure type is an extension of &lt;tt&gt;date&lt;/tt&gt; with &lt;tt&gt;nanosecond&lt;/tt&gt; and &lt;tt&gt;time-zone-name&lt;/tt&gt; fields.&lt;/li&gt;
&lt;li&gt;New looping constructs: &lt;tt&gt;for/sum&lt;/tt&gt; and &lt;tt&gt;for/product&lt;/tt&gt;.&lt;/li&gt;
&lt;li&gt;Direct calls to keyword-accepting functions are now optimized to eliminate the overhead of keywords.  In addition, the compiler detects and logs warnings for keyword-argument mismatches.&lt;/li&gt;
&lt;li&gt;The libfit interface is available from &lt;tt&gt;plot/deprecated/fit&lt;/tt&gt;, and will be removed in the near future.&lt;/li&gt;
&lt;li&gt;The Unix installer has been re-done, and it is now more robust.&lt;/li&gt;
&lt;li&gt;The built-in reader and printer support for Honu is removed.  (This functionality is re-implemented in Racket.)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;On-line Check Syntax:&lt;/h3&gt;
&lt;p&gt;DrRacket now provides an on-line version of the syntax check tool, which means that syntax checking runs automatically while you continue to edit a program.  With this tool enabled, its annotations (e.g., binding arrows) and actions (e.g., the renaming refactoring and direct documentation links) are almost always available.&lt;/p&gt;
&lt;p&gt;We have noticed that on-line syntax checking renders DrRacket unstable on occasion, perhaps because it relies on relatively new support for parallelism.  Occurrences of the problem are rare, but they are not rare enough, which is why we have disabled the tool by default.  At the same time, current users of the tool find it so valuable that we felt it should be included in the release.  We expect to track down the remaining problems and enable the tool by default in near-future release.&lt;/p&gt;
&lt;p&gt;To enable on-line syntax checking (for &lt;tt&gt;#lang&lt;/tt&gt;-based programs only), click on the red dot in the bottom right of DrRacket's window.  To turn it off, click there again.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-453161652899215709?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/453161652899215709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=453161652899215709' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/453161652899215709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/453161652899215709'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2011/11/racket-v52.html' title='&lt;a href=&quot;http://racket-lang.org/&quot;&gt;Racket v5.2&lt;/a&gt;'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/04250857957616050612</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://3.bp.blogspot.com/-YI1Vg8itdSQ/Trtea3cqYQI/AAAAAAAAACA/eHNhhe5FSLM/s220/eli-small.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-176509377051155662</id><published>2011-10-18T14:28:00.004-04:00</published><updated>2011-10-18T15:07:12.023-04:00</updated><title type='text'>On eval in dynamic languages generally and in Racket specifically</title><content type='html'>&lt;p&gt;The &lt;tt&gt;eval&lt;/tt&gt; function is at the heart of a dynamic language,
and it strikes many newcomers as an amazingly powerful tool. At the
same time, experienced programmers avoid &lt;tt&gt;eval&lt;/tt&gt;, because
unnecessary use creates trouble. It&amp;rsquo;s not easy to explain
why &lt;tt&gt;eval&lt;/tt&gt; should be avoided or when it&amp;rdquo;s appropriate to
use &lt;tt&gt;eval&lt;/tt&gt;, but I&amp;rsquo;ll take another stab at it here.


&lt;h3&gt;What is &lt;tt&gt;eval&lt;/tt&gt;?&lt;/h3&gt;

&lt;p&gt;Consider the following &amp;ldquo;program&amp;rdquo; in English prose:&lt;/p&gt;

&lt;blockquote&gt;
 Assume that your favorite color is red. Now imagine a balloon that is
 your favorite color. Paint a canvas the same color as the balloon.
&lt;/blockquote&gt;

&lt;p&gt;As English goes, that&amp;rsquo;s a fairly clear program with a fairly
well-defined result. When I follow those instructions, at least, I
will always produce a red canvas (assuming that I have a canvas and
some red paint, but a potential lack of art supplies is not the point
here).&lt;/p&gt;

&lt;p&gt;I would come up with a red canvas even if I read the instructions when
surrounded by people who speak only Chinese, obviously, since I&amp;rsquo;m the
one reading the instructions. Furthermore, it would be straightforward
to translate the program to Chinese, and then a person who reads
Chinese would produce a red canvas.&lt;/p&gt;

&lt;p&gt;A translator might even take the liberty of simplifying the program to
just&lt;/p&gt;

&lt;blockquote&gt;
  Paint a canvas red.
&lt;/blockquote&gt;

&lt;p&gt;The translation loses some of the poetry of the original, but the
result is the same.&lt;/p&gt;

&lt;p&gt;In Racket terms, the paragraph corresponds to a module. It can be
compiled (i.e., translated) and optimized (i.e., simplified). A
program can be made up of multiple modules that are written in
different languages, but since each module can be reliably translated,
they can all be compiled into some common language to run the
program.&lt;/p&gt;


&lt;p&gt;Here&amp;rsquo;s a different program:&lt;/p&gt;

&lt;blockquote&gt;
 Tell the person next to you &amp;ldquo;Assume that your favorite color is red.&amp;rdquo;
 Tell the person &amp;ldquo;Now, imagine a balloon that is your favorite color.&amp;rdquo;
 Tell the person &amp;ldquo;Paint canvas the same color as the balloon.&amp;rdquo;
&lt;/blockquote&gt;

&lt;p&gt;Getting a red canvas back may be a little trickier in this case. If the
person next to me speaks only Chinese, then my program may fail with a
message-not-understood error.&lt;/p&gt;

&lt;p&gt;If I want to translate the program to Chinese, then it&amp;rsquo;s not clear
whether the parts in quotes should be translated. Maybe I mean for a
person who can read Chinese but only sound out English to run the
program when surrounded by English speakers, or maybe I mean for a
Chinese person to run the program when surrounded by Chinese people.
Either way, I have to be a lot more specific to a translator. For more
complex programs, the instructions to the translator can become
complex and fragile.&lt;/p&gt;

&lt;p&gt;Finally, a translator probably won&amp;rsquo;t feel comfortable simplifying the
program to&lt;/p&gt;

&lt;blockquote&gt;
 Tell the person next to you &amp;ldquo;Paint a canvas red.&amp;rdquo;
&lt;/blockquote&gt;

&lt;p&gt;
because there could be all sorts of environmental conditions that make
the result different&amp;mdash;such as people who are willing to paint
but unwilling to accept assumptions about their favorite colors.&lt;/p&gt;

&lt;p&gt;The paragraph with &amp;ldquo;tell the person...&amp;rdquo; is a program that uses &lt;tt&gt;eval&lt;/tt&gt;.
It can&amp;rsquo;t be compiled and optimized as well as the earlier paragraph, and the language context
in which it is run may change the result. The quotes around sentences
correspond to the quote in front of an expression passed to &lt;tt&gt;eval&lt;/tt&gt; in
Racket; there&amp;rsquo;s no particular reason that the language for &lt;tt&gt;eval&lt;/tt&gt; will
match the language of the program that has the quoted text. The
issues become even more complex if you try to implement different
parts of the program in different languages.&lt;/p&gt;

&lt;p&gt;If the analogy to multiple spoken languages seems strange&amp;mdash;maybe
your language is Javascript, period&amp;mdash;the problem of translation to
another language is really a proxy for program understanding. There&amp;rsquo;s
a direct connection to performance and optimization (i.e., translation
to efficient machine code), but using &lt;tt&gt;eval&lt;/tt&gt; also makes a program more
difficult to understand for the same reasons that it makes the program
more difficult to translate. For example, a reader of your program may
not be able to tell whether &amp;ldquo;assume your favorite color is red&amp;rdquo; is
just a rhetorical device to get to a red canvas or whether some new
instructions will arrive that will ask for your favorite color.&lt;/p&gt;


&lt;h3&gt;When is &lt;tt&gt;eval&lt;/tt&gt; Good?&lt;/h3&gt;

&lt;p&gt;The program with &amp;ldquo;tell the person next to you&amp;rdquo; above uses &lt;tt&gt;eval&lt;/tt&gt; in a
bad way. The task could just as well be performed by the person reading
the instructions, instead of getting another nearby person involved.&lt;/p&gt;

&lt;p&gt;Some other uses &lt;tt&gt;eval&lt;/tt&gt; are both good and necessary. For example,
consider the following program:&lt;/p&gt;

&lt;blockquote&gt;
 Ask the construction manager for instructions. Walk to the building
 site and convey those instructions to the construction crew.
&lt;/blockquote&gt;

&lt;p&gt;This program uses &lt;tt&gt;eval&lt;/tt&gt; when it conveys instructions to the
construction crew, but no quoted forms appear in the program. The
absence of quoted code is one sign that &lt;tt&gt;eval&lt;/tt&gt; may be
appropriate. Note that the program could work no matter what language
the manager and crew speak, although there is an implicit (and
sometimes non-trivial) assumption that the manager and crew speak the
same language.&lt;p&gt;

&lt;p&gt;Here&amp;rsquo;s another example:&lt;/p&gt;

&lt;blockquote&gt;
 Go outside, and tell each member of the construction crew &amp;ldquo;take a
 lunch break, now.&amp;rdquo;
&lt;/blockquote&gt;

&lt;p&gt;There&amp;rsquo;s a quoted program in this case, but it&amp;rsquo;s crucial to ask other
people to run the quoted program, instead of just taking the lunch
break yourself. That is, &lt;tt&gt;eval&lt;/tt&gt; is really necessary. The implementor
of this program takes on the burden of making sure that the
instructions are in a suitable language, however, and may need to
parameterize the quoted program by an explicit action to translate it
to a language understood by the construction crew.&lt;/p&gt;

&lt;p&gt;Here&amp;rsquo;s one more reasonable example:&lt;/p&gt;

&lt;blockquote&gt;
 Ask the construction manager for instructions. Follow them.
&lt;/blockquote&gt;

&lt;p&gt;In this case, it&amp;rsquo;s the construction manager&amp;rsquo;s problem to give you
instructions in a language that you understand.&lt;/p&gt;

&lt;p&gt;Here&amp;rsquo;s a questionable example:&lt;/p&gt;

&lt;blockquote&gt;
 Decide how long to work before lunch, say N hours, and write a note
 to yourself to work N hours. Add to the note by telling yourself to
 take a lunch break afterward.
&lt;/blockquote&gt;

&lt;p&gt;If you could really write that program without quotes, then it&amp;rsquo;s
probably ok. The example is misleading, though, because languages
don&amp;rsquo;t usually support&lt;/p&gt;

&lt;blockquote&gt;
 write a note to yourself to work N hours
&lt;/blockquote&gt;

&lt;p&gt;You&amp;rsquo;d have to write instead&lt;/p&gt;

&lt;blockquote&gt;
 write a note to yourself that says &amp;ldquo;work&amp;rdquo; followed by the number N
 and then &amp;ldquo;hours&amp;rdquo;
&lt;/blockquote&gt;

&lt;p&gt;and the quote marks are where the problem comes in. If you translate
the program to Chinese, then you have to be careful to somehow
translate &amp;ldquo;work&amp;rdquo; and &amp;ldquo;hours&amp;rdquo; to Chinese, too.&lt;/p&gt;

&lt;p&gt;The point here is not that programs without quoted text are clearly
good or that programs with quoted text are clearly bad. The real point
is that a programmer has to be especially careful about passing around
instructions and using quoted instructions. Using &lt;tt&gt;eval&lt;/tt&gt; means
accepting the burden of using instructions will make sense by the time
they are delivered. That burdened is best avoided, which is why
experienced programmers avoid &lt;tt&gt;eval&lt;/tt&gt;, but some of the examples
illustrate cases where the burden is not avoidable or where the
actions enabled by &lt;tt&gt;eval&lt;/tt&gt; make the burden worthwhile.&lt;/p&gt;


&lt;h3&gt;Using &lt;tt&gt;eval&lt;/tt&gt; in Racket&lt;/h3&gt;

&lt;p&gt;In the context of Racket, the multiple-language analogy is relatively
accurate, because Racket is about having many programming languages
work together and allowing programmers to define ever better languages
and language constructs. In Racket, it&amp;rsquo;s especially likely that a
library written in one language is used in a context where another
language is the default.&lt;/p&gt;

&lt;p&gt;Newcomers to Racket sometimes stumble over the fact that&lt;/p&gt;

&lt;pre&gt;
 #lang racket
 (define my-x 1)
 (eval '(+ my-x 2))
&lt;/pre&gt;

&lt;p&gt;or even&lt;/p&gt;

&lt;pre&gt;
 #lang racket
 (eval '(+ 1 2))
&lt;/pre&gt;

&lt;p&gt;does not work at all, and yet if the program&lt;/p&gt;

&lt;pre&gt;
 #lang racket
 (define my-x 1)
&lt;/pre&gt;

&lt;/p&gt;is loaded into a read-eval-print loop&amp;mdash;for example, by clicking the
&amp;ldquo;Run&amp;rdquo; button in DrRacket and then typing into the lower interactions
panel&amp;mdash;then&lt;/p&gt;

&lt;pre&gt;
 (eval '(+ my-x 2))
&lt;/pre&gt;

&lt;p&gt;works as expected.&lt;/p&gt;

&lt;p&gt;DrRacket&amp;rsquo;s interactions window has to use &lt;tt&gt;eval&lt;/tt&gt; in the sense that it
reads an expression to evaluate and then passes it on to the
interpreter for an answer. More generally, to make various pieces of
the environment fit together, DrRacket sets &lt;tt&gt;eval&lt;/tt&gt; globally to use the
module&amp;rsquo;s language while evaluating expressions in the interactions
window. In Racket terminology, DrRacket sets the &lt;tt&gt;current-namespace&lt;/tt&gt;
parameter to the module&amp;rsquo;s namespace when it initializes the
interactions window. In contrast, while the module body is being
evaluated, &lt;tt&gt;eval&lt;/tt&gt; treats expressions as being in the language that is
empty by default, which is why &lt;tt&gt;eval&lt;/tt&gt; during the module evaluation
produces a different result from &lt;tt&gt;eval&lt;/tt&gt; during the interactions
windows.&lt;/p&gt;

&lt;p&gt;You may wonder why DrRacket doesn&amp;rsquo;t initialize the namespace of &lt;tt&gt;eval&lt;/tt&gt;
to be the module&amp;rsquo;s namespace from the start, so that in-module uses of
&lt;tt&gt;eval&lt;/tt&gt; and the interactions window behave the same. In a program that
is implemented by multiple modules, which module&amp;rsquo;s language should be
used? In particular, if the language it&amp;rsquo;s always the main module&amp;rsquo;s
language, then a module may behave differently on its own than as part
of a larger program. In the process of developing Racket and DrRacket,
we&amp;rsquo;ve seen many such problems, and so Racket now arranges for the
default language to be empty (which is different from any useful
language) to help programmers remember that there&amp;rsquo;s a language issue
to consider whenever &lt;tt&gt;eval&lt;/tt&gt; is used.&lt;/p&gt;

&lt;p&gt;The Racket Guide&amp;rsquo;s chapter 15 covers in more depth the issues and
namespace tools of Racket for harnessing the power of &lt;tt&gt;eval&lt;/tt&gt;:&lt;/p&gt;

&lt;blockquote&gt;
 &lt;a href="http://docs.racket-lang.org/guide/reflection.html"&gt;http://docs.racket-lang.org/guide/reflection.html&lt;/a&gt;
&lt;/blockquote&gt;

&lt;p&gt;Think of &lt;tt&gt;eval&lt;/tt&gt; as a power tool. For some tasks,
there&amp;rsquo;s no real substitute, and so we want &lt;tt&gt;eval&lt;/tt&gt;
around. At the same time, &lt;tt&gt;eval&lt;/tt&gt; should be used with care. In
dynamic languages generally, that means a reluctant and targeted use
&lt;tt&gt;eval&lt;/tt&gt;. In Racket specifically, it means knowing the namespace toolbox
and being as explicit as possible about the intended context for
dynamic evaluation.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-176509377051155662?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/176509377051155662/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=176509377051155662' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/176509377051155662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/176509377051155662'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2011/10/on-eval-in-dynamic-languages-generally.html' title='On eval in dynamic languages generally and in Racket specifically'/><author><name>Matthew Flatt</name><uri>http://www.blogger.com/profile/03369511886823036667</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-5257012253577974725</id><published>2011-08-16T04:15:00.000-04:00</published><updated>2011-11-09T22:50:37.950-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>Racket v5.1.3</title><content type='html'>Racket version 5.1.3 is now available from&lt;pre&gt;  &lt;a href="http://racket-lang.org/"&gt;http://racket-lang.org/&lt;/a&gt;&lt;/pre&gt;&lt;p&gt;This is a bugfix release, resolving the DrRacket issue with the contour view.  In addition, two tex files with problematic licensing were removed.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-5257012253577974725?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://racket-lang.org/' title='Racket v5.1.3'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/5257012253577974725/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=5257012253577974725' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/5257012253577974725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/5257012253577974725'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2011/08/racket-v513.html' title='Racket v5.1.3'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-7519203787706361878</id><published>2011-08-03T15:47:00.004-04:00</published><updated>2011-11-09T22:50:37.967-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>Racket v5.1.2</title><content type='html'>Racket version 5.1.2 is now available from&lt;pre&gt;  &lt;a href="http://racket-lang.org/"&gt;http://racket-lang.org/&lt;/a&gt;&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;The download page includes 64-bit installers for Mac OS X, Windows, and two Debian flavors.  Racket now supports OS X Lion.&lt;/li&gt;&lt;li&gt;Racket now includes a new &lt;tt&gt;racket/place&lt;/tt&gt; library to support parallelism, complementing &lt;tt&gt;racket/future&lt;/tt&gt;.  Racket's parallel build process is now based on places instead of multiple OS processes.&lt;br&gt;Places support share-nothing parallelism and message-passing communication.  Compared to futures, places are heavyweight, but they have a simpler performance model.&lt;/li&gt;&lt;li&gt;The syntax-certificate system has been replaced by a syntax-taint system.  Both certificates and taints were designed to protect otherwise inaccessible bindings from abuse when they appear in macro expansions.  Taints are simpler and lighter, and the switch closes known holes in the certificate system.  Macros that are not implemented with &lt;tt&gt;syntax-rules&lt;/tt&gt; or &lt;tt&gt;define-syntax-rule&lt;/tt&gt;, however, must explicitly use &lt;tt&gt;syntax-protect&lt;/tt&gt; to protect their expansions from abuse.&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;net/url&lt;/tt&gt; library supports HTTPS connections, but beware that by default all sites are accepted (equivalent to ignoring a browser's warnings about untrusted certificates).&lt;/li&gt;&lt;li&gt;Error messages in the student languages use a simplified vocabulary and consistent phrasings.  If you maintain curriculum material or teachpacks then please consider updating.  See the “Error Message Composition Guidelines” section in the documentation for details.&lt;/li&gt;&lt;li&gt;Typed Racket: almost all core Racket data structures and operations are now accessible in Typed Racket (most of this work is due to prolific contributor Eric Dobson).  The performance of the typechecker has been significantly improved.&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;scriblib/bibtex&lt;/tt&gt; library supports BibTeX-formatted citation databases in Scribble documents.  BibTeX can be tricky to parse, so please report failed entries as bug reports.&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;for&lt;/tt&gt; forms now support an &lt;tt&gt;#:unless&lt;/tt&gt; clause, and a nonnegative integer can be used as a sequence.  The new &lt;tt&gt;compose1&lt;/tt&gt; function creates single-valued composition functions.  The &lt;tt&gt;racket/function&lt;/tt&gt; library now provides &lt;tt&gt;identity&lt;/tt&gt;, &lt;tt&gt;thunk&lt;/tt&gt;, and &lt;tt&gt;thunk*&lt;/tt&gt;.&lt;/li&gt;&lt;li&gt;The license has been clarified: we now use LGPLv2.1 uniformly.  (The license file used to specify LGPLv2, contrary to the download pages.)&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-7519203787706361878?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://racket-lang.org/' title='Racket v5.1.2'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/7519203787706361878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=7519203787706361878' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/7519203787706361878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/7519203787706361878'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2011/08/racket-v512.html' title='Racket v5.1.2'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-4765317171885687427</id><published>2011-07-29T02:36:00.002-04:00</published><updated>2011-08-03T19:25:14.556-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='racketcon'/><title type='text'>RacketCon Recap</title><content type='html'>We held &lt;a href="http://con.racket-lang.org/"&gt;RacketCon&lt;/a&gt; here at &lt;a href="http://www.ccis.neu.edu/2011/"&gt;Northeastern&lt;/a&gt; over the past weekend, and it was a great time!&amp;nbsp; Matthew Flatt consulted his magic 8-ball about the future of Racket (it involves Hawaiian shirts); Matthias Felleisen announced the upcoming Realm of Racket book; Robby Findler demoed DrRacket with online syntax checking; Ryan Culpepper taught us how to make Rackety libraries; Prabhakar Ragde explained how the University of Waterloo teaches Racket and Program by Design to 1500 students a year (and how to embed math into Scribble documents).&lt;br /&gt;
&lt;br /&gt;
Danny Yoo has already &lt;a href="http://blog.hashcollision.org/?p=162"&gt;blogged&lt;/a&gt; about his talk about his &lt;a href="http://hashcollision.org/whalesong/"&gt;Whalesong&lt;/a&gt; Racket-&amp;gt;JavaScript compiler. Hopefully other people will write more about some of the individual talks; I'll update this post to link to any that I see.&lt;br /&gt;
&lt;br /&gt;
As promised, the talks were videotaped by Jeff Dlouhy of the &lt;a href="http://acm.ccs.neu.edu/"&gt;NUACM&lt;/a&gt;; the videos are in post-production and should be up within a few weeks. We'll announce their availability on this blog.&amp;nbsp; Slides from the individual talks will be up on the &lt;a href="http://con.racket-lang.org/2011/"&gt;RacketCon webpage&lt;/a&gt; soon.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-4765317171885687427?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/4765317171885687427/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=4765317171885687427' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/4765317171885687427'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/4765317171885687427'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2011/07/racketcon-recap.html' title='RacketCon Recap'/><author><name>Sam Tobin-Hochstadt</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-546301615685805019</id><published>2011-06-29T17:25:00.003-04:00</published><updated>2011-07-29T17:53:47.051-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='racketcon'/><title type='text'>Come to RacketCon!</title><content type='html'>&lt;center&gt;&lt;b&gt;Calling All Racketeers!&lt;/b&gt;&lt;/center&gt;

&lt;p&gt;Join us at RacketCon, 23 &amp;amp; 24 July 2011.&lt;/p&gt;
&lt;p&gt;&lt;center&gt;&lt;a href="http://con.racket-lang.org/"&gt;http://con.racket-lang.org/&lt;/a&gt;&lt;/center&gt;&lt;/p&gt;

&lt;p&gt;
The schedule for RacketCon is now available, and includes
presentations by key members of the Racket team, including Matthew
Flatt on the future of Racket and Matthias Felleisen on the Program By
Design curriculum, as well as tutorials on building web applications
and accessing low-level libraries.
&lt;/p&gt;

&lt;p&gt;
The meeting will take place at Northeastern University in Boston, MA.
It will be an opportunity for developers, researchers, and educators
using Racket, DrRacket, Program By Design, and related technologies to
come together to share plans, ideas, and enthusiasm.  To make it
accessible, we will not charge any registration fees; we'll also serve
you breakfast and lunch.&lt;/p&gt;

&lt;p&gt;We're excited about RacketCon, and hope you'll join us there. To
register for RacketCon, please send an email with your name and
affiliation to &lt;a href="mailto:racketcon@racket-lang.org"&gt;racketcon@racket-lang.org&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;
Additional information, including registration, transportation and
hotel information, can be found on the web page:
&lt;a href="http://con.racket-lang.org"&gt;http://con.racket-lang.org&lt;/a&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-546301615685805019?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://con.racket-lang.org/' title='Come to RacketCon!'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/546301615685805019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=546301615685805019' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/546301615685805019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/546301615685805019'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2011/06/come-to-racketcon.html' title='Come to RacketCon!'/><author><name>Sam Tobin-Hochstadt</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-5086396725121935681</id><published>2011-05-26T13:46:00.008-04:00</published><updated>2011-05-26T15:18:31.480-04:00</updated><title type='text'>Multi-file code coverage viewing tool</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/-bqUHiG2gf6M/Td6l76u3kMI/AAAAAAAAAGE/HEpOctSVSIc/s1600/covered-files-dialog.png"&gt;&lt;img style="float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 131px;" src="http://3.bp.blogspot.com/-bqUHiG2gf6M/Td6l76u3kMI/AAAAAAAAAGE/HEpOctSVSIc/s320/covered-files-dialog.png" alt="" id="BLOGGER_PHOTO_ID_5611104634546917570" border="0" /&gt;&lt;/a&gt;
&lt;p&gt;I'm very pleased to announce the availability of a multi-file code coverage viewer, written by Jonathan Walsh.&lt;/p&gt;


&lt;p&gt;Torn between separating your test cases into another file and actually seeing the coverage? Well, go ahead and pull them apart, because the multi-file coverage tool displays coverage information for the files required by the present one, including both percentage covered (on a line-by-line basis) and optionally a list of uncovered lines (no more inching through your code, looking for the red highlighting.&lt;/p&gt;



&lt;a href="http://3.bp.blogspot.com/-d4j23yei4rc/Td6l0wv3UCI/AAAAAAAAAF8/ptD2u9KwevE/s1600/coverage-button.png"&gt;&lt;img style="float: left; margin: 0pt 10px 10px 0pt; cursor: pointer; width: 320px; height: 117px;" src="http://3.bp.blogspot.com/-d4j23yei4rc/Td6l0wv3UCI/AAAAAAAAAF8/ptD2u9KwevE/s320/coverage-button.png" alt="" id="BLOGGER_PHOTO_ID_5611104511607656482" border="0" /&gt;&lt;/a&gt;
&lt;span style="font-weight: bold;"&gt;Back End:&lt;/span&gt;


&lt;p&gt;One reason I expect this tool to be long-term robust is that it makes absolutely no changes to the back-end; that is, it just uses the existing code coverage framework. The only thing going on here is that the tool provides a way to store, load, and display this information. This means that the tool displays coverage for un-compiled files only. We thought about fiddling with this, but finally decided that the existing behavior was probably about as useful as anything else we'd come up with, and a lot more robust.&lt;/p&gt;


&lt;p&gt;URL for docs:&lt;/p&gt;


&lt;p&gt;&lt;a href="http://planet.racket-lang.org/package-source/jowalsh/code-coverage.plt/1/3/planet-docs/code-coverage/index.html"&gt;http://planet.racket-lang.org/package-source/jowalsh/code-coverage.plt/1/3/planet-docs/code-coverage/index.html&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;As you might expect, it's a one-line install:&lt;/p&gt;


&lt;blockquote style="font-family: courier new;"&gt;#lang racket&lt;br&gt;
(require (planet jowalsh/code-coverage))
&lt;/blockquote&gt;


&lt;p&gt;Please let us know about bugs you discover!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-5086396725121935681?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://planet.racket-lang.org/display.ss?package=code-coverage.plt&amp;owner=jowalsh' title='Multi-file code coverage viewing tool'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/5086396725121935681/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=5086396725121935681' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/5086396725121935681'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/5086396725121935681'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2011/05/multi-file-code-coverage-viewing-tool.html' title='Multi-file code coverage viewing tool'/><author><name>John Clements</name><uri>http://www.blogger.com/profile/15701081040575095781</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-bqUHiG2gf6M/Td6l76u3kMI/AAAAAAAAAGE/HEpOctSVSIc/s72-c/covered-files-dialog.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-7456665387737613746</id><published>2011-05-26T08:21:00.004-04:00</published><updated>2011-05-26T11:40:46.799-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='interview'/><category scheme='http://www.blogger.com/atom/ns#' term='matthew'/><title type='text'>Racket on FLOSS Weekly</title><content type='html'>&lt;p&gt;Our own &lt;a href="http://www.cs.utah.edu/~mflatt/"&gt;Matthew Flatt&lt;/a&gt; was interviewed about Racket &lt;a href="http://twit.tv/floss167"&gt;on FLOSS Weekly&lt;/a&gt;.  Also available on &lt;a href="http://www.youtube.com/watch?v=vJGV7HaTdbg"&gt;YouTube&lt;/a&gt;.&lt;/p&gt;

&lt;iframe width="425" height="349" src="http://www.youtube.com/embed/vJGV7HaTdbg" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-7456665387737613746?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/7456665387737613746/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=7456665387737613746' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/7456665387737613746'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/7456665387737613746'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2011/05/racket-on-floss-weekly.html' title='Racket on FLOSS Weekly'/><author><name>Robby</name><uri>http://www.blogger.com/profile/08402308775580442837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='13' height='32' src='http://people.cs.uchicago.edu/~robby/portrait-2006.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://img.youtube.com/vi/vJGV7HaTdbg/default.jpg' height='72' width='72'/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-6203425329791139673</id><published>2011-04-30T04:19:00.002-04:00</published><updated>2011-11-09T22:50:37.954-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>Racket v5.1.1</title><content type='html'>Racket version 5.1.1 is now available from&lt;pre&gt;  &lt;a href="http://racket-lang.org/"&gt;http://racket-lang.org/&lt;/a&gt;&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;The new &lt;tt&gt;racket/stream&lt;/tt&gt; library provides &lt;tt&gt;stream-first&lt;/tt&gt;, &lt;tt&gt;stream-rest&lt;/tt&gt;, a lazy &lt;tt&gt;stream-cons&lt;/tt&gt;, and so on.  Streams are a subtype of sequences, so they work in &lt;tt&gt;for&lt;/tt&gt; forms.  Some sequence generators, such as &lt;tt&gt;in-range&lt;/tt&gt;, now produce streams.  A &lt;tt&gt;racket/sequence&lt;/tt&gt; library replaces the old &lt;tt&gt;racket/stream&lt;/tt&gt; library.&lt;/li&gt;&lt;li&gt;The new &lt;tt&gt;racket/syntax&lt;/tt&gt; library contains facilities useful for writing macros.  The new &lt;tt&gt;syntax/srcloc&lt;/tt&gt; and &lt;tt&gt;syntax/location&lt;/tt&gt; libraries provide support for manipulating source locations.&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;racket/gui&lt;/tt&gt; library now supports multi-column list boxes and scrolling panels.&lt;/li&gt;&lt;li&gt;The new &lt;tt&gt;ffi/file&lt;/tt&gt; library is useful for writing foreign library bindings that cooperate with Racket's security guard mechanism.&lt;/li&gt;&lt;li&gt;Generators from the &lt;tt&gt;racket/generator&lt;/tt&gt; library can now have formal arguments that are used when the generator is fired up.&lt;/li&gt;&lt;li&gt;Single-precision floating-point support is now enabled by default.  Single-precision floats print differently from their default double-precision counterparts, new primitives convert between the two precisions, and new reader syntax supports single-precision literals.&lt;/li&gt;&lt;li&gt;JIT improvements include a small change to aid x86 branch prediction on function-call returns, which can speed up some programs significantly.&lt;/li&gt;&lt;li&gt;Typed Racket:&lt;ul&gt;&lt;li&gt;The numeric tower has been entirely overhauled.  TR programs can now use more precise types than before, and check more numeric properties, such as sign or range properties.&lt;/li&gt;&lt;li&gt;Fixnum optimizations have been improved and should apply more broadly.&lt;/li&gt;&lt;li&gt;The performance of the typechecker has been improved.  In particular, dispatch on large union types should typecheck much faster than before.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;The Stepper can now step through Lazy Racket programs.&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;racket/future&lt;/tt&gt; library includes &lt;tt&gt;fsemaphore&lt;/tt&gt; values, the &lt;tt&gt;future&lt;/tt&gt; primitive no longer freezes futures (so a future can spawn new futures), and &lt;tt&gt;future&lt;/tt&gt; log messages are more informative.&lt;/li&gt;&lt;li&gt;PLaneT development links are now version-specific.&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;2htdp/image&lt;/tt&gt; library now includes &lt;tt&gt;overlay/align&lt;/tt&gt;, &lt;tt&gt;underlay/align&lt;/tt&gt;, &lt;tt&gt;overlay/align/offset&lt;/tt&gt; and &lt;tt&gt;underlay/align/offset&lt;/tt&gt;.&lt;/li&gt;&lt;li&gt;The network protocol for universes in &lt;tt&gt;2htdp/universe&lt;/tt&gt; has changed, so that v5.1.1 is incompatible with earlier versions.&lt;/li&gt;&lt;li&gt;The "DrScheme" application (which simply ran DrRacket in the last few releases) has been removed.  The "MrEd" GUI executables for Windows and Mac OS X have also been removed, although the "mred" console executable remains for Unix and Mac OS X to support old scripts.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-6203425329791139673?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://racket-lang.org/' title='Racket v5.1.1'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/6203425329791139673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=6203425329791139673' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/6203425329791139673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/6203425329791139673'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2011/04/racket-v511.html' title='Racket v5.1.1'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-1248551246168499369</id><published>2011-04-04T14:00:00.001-04:00</published><updated>2011-04-08T22:20:30.687-04:00</updated><title type='text'>Writing ‘syntax-case’ Macros</title><content type='html'>&lt;p&gt;Disclaimer: This is not really a tutorial on macros, it's more of a quick introduction to using Racket's &lt;code&gt;syntax-case&lt;/code&gt;-based macros for people who are familiar with symbolic macros and miss their “simplicity”.  It's also not comprehensive or thorough or complete, it's just intended to provide a rough quick overview of how to write macros.  It was originally posted on comp.lang.scheme in a thread called “Idiot's guide to Scheme macros”, but I avoided that title here, since it's not a general purpose guide.  (Also, it's yet another attempt to dispel the irrational “macrophobia” some people have when it gets to hygienic macros, leading them back to using &lt;code&gt;defmacro&lt;/code&gt; with all its problems.)&lt;/p&gt;&lt;p&gt;The main idea with Racket's macro system (and with other &lt;code&gt;syntax-case&lt;/code&gt; systems) is that macros are syntax to syntax functions, just like the case of &lt;code&gt;defmacro&lt;/code&gt;, except that instead of raw s-expressions you're dealing with syntax objects.  This becomes very noticeable when identifiers are handled: instead of dealing with plain symbols, you're dealing with these syntax values (called “identifiers” in this case) that are essentially a symbol and &lt;em&gt;some opaque information&lt;/em&gt; that represents the lexical scope for its source.  In several &lt;code&gt;syntax-case&lt;/code&gt; systems this is the only difference from &lt;code&gt;defmacro&lt;/code&gt; macros, but in the Racket case this applies to everything — identifiers, numbers, other immediate constants, and even function applications, etc — they are all the same s-expression values that you're used to, except wrapped with additional information.  Another thing that is unique to Racket is the extra information: in addition to the opaque lexical context, there is also source information and arbitrary properties (there are also certificates, but that's ignorable for this text).&lt;/p&gt;&lt;p&gt;With this in mind, explaining the rest is not too difficult:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;code&gt;(syntax-source stx)&lt;/code&gt;, &lt;code&gt;(syntax-position stx)&lt;/code&gt;, &lt;code&gt;(syntax-line stx)&lt;/code&gt;, &lt;code&gt;(syntax-column stx)&lt;/code&gt; — retrieve parts of the source location information.&lt;/li&gt;&lt;li&gt;&lt;code&gt;(syntax-e stx)&lt;/code&gt; — takes a syntax value and returns the value it “wraps”.  For example, if &lt;code&gt;stx&lt;/code&gt; is an identifier you'd get a symbol, and if it's a number you'd get the number.  If it's a simple parenthesized form, you'd get a list of syntax values for the subforms.  Note that the list can be improper, with the last element being a syntax object that contains a proper list.  (But the list will actually be improper if the original syntax was a dotted list.)&lt;/li&gt;&lt;li&gt;&lt;code&gt;(syntax-&amp;gt;datum stx)&lt;/code&gt; — takes a syntax value and returns the plain s-expression that it holds.  This is done by recursive uses of &lt;code&gt;syntax-e&lt;/code&gt;.  (It would be a simple definition that does what you'd think it should do.)&lt;/li&gt;&lt;li&gt;&lt;code&gt;(syntax-&amp;gt;list stx)&lt;/code&gt; — sometimes you want to pull out the list of syntax values from a given parenthesized syntax, but &lt;code&gt;syntax-e&lt;/code&gt; does too little (can still return an improper list) and &lt;code&gt;syntax-&amp;gt;datum&lt;/code&gt; does too much (gives you back raw s-expressions).  &lt;code&gt;syntax-&amp;gt;list&lt;/code&gt; is a utility function that uses &lt;code&gt;syntax-e&lt;/code&gt; as many times as needed to get back a proper list of syntax values.  If that's not possible (if the input syntax was not a proper list), it returns &lt;code&gt;#f&lt;/code&gt;, so it serves as a predicate too.&lt;/li&gt;&lt;li&gt;&lt;code&gt;(syntax-property stx prop)&lt;/code&gt; — returns the given property value from stx, if any, and &lt;code&gt;#f&lt;/code&gt; if none.  For example, try&lt;blockquote&gt;&lt;pre&gt;(syntax-property #'[foo] 'paren-shape)&lt;/pre&gt;&lt;/blockquote&gt;(The &lt;code&gt;#'&lt;/code&gt; is similar to a quote, but for syntax values — I'll get to that later on.)&lt;/li&gt;&lt;li&gt;Note that there is &lt;em&gt;no&lt;/em&gt; accessor for the opaque lexical scope, and as you'll see next, you don't need one.&lt;/li&gt;&lt;li&gt;To create a piece of syntax you use &lt;code&gt;datum-&amp;gt;syntax&lt;/code&gt;, and you give it an s-expression which will be the “contents” of the resulting syntax object.  (The input can contain syntax values, which are left as is.)  But when you do that you need to give it the other bits — including the lexical context thing, which you have no access to.  The way that's done is:&lt;blockquote&gt;&lt;pre&gt;(datum-&amp;gt;syntax context-stx input-sexpr)&lt;/pre&gt;&lt;/blockquote&gt; This returns a syntax value that wraps the &lt;code&gt;input-sexpr&lt;/code&gt; value, using the lexical scope from &lt;code&gt;context-stx&lt;/code&gt;.  A common way to “break hygiene” and create a binding that is visible to the macro user's code is:&lt;blockquote&gt;&lt;pre&gt;(datum-&amp;gt;syntax stx 'foo)&lt;/pre&gt;&lt;/blockquote&gt;where &lt;code&gt;stx&lt;/code&gt; is some syntax value that you get from the user input to the macro.  It returns a &lt;code&gt;foo&lt;/code&gt; identifier that has the same lexical context information as &lt;code&gt;stx&lt;/code&gt;, so it's as if it came from there.&lt;br /&gt;Note that there is actually another optional argument that specifies the source (either using another syntax object, or as an explicit list), and another for copying the properties from — so an alternative to the above would be:&lt;blockquote&gt;&lt;pre&gt;(datum-&amp;gt;syntax stx 'foo stx stx)&lt;/pre&gt;&lt;/blockquote&gt;which also makes the source information and the properties be the same as those of &lt;code&gt;stx&lt;/code&gt; (for example, this can matter in case of syntax errors ).&lt;/li&gt;&lt;li&gt;There is also &lt;code&gt;(quote-syntax blah)&lt;/code&gt; which creates a quoted syntax, with its lexical source from the place it appears.&lt;/li&gt;&lt;li&gt;Finally, &lt;code&gt;define-syntax&lt;/code&gt; does the magic of tying a name with a transformer function.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;And that's almost everything that you need in order to write hygienic (and non-hygienic) macros.  Very inconveniently.&lt;/p&gt;&lt;p&gt;For example, here's a simple &lt;code&gt;while&lt;/code&gt; macro (use this in a file that starts with “&lt;code&gt;#lang racket&lt;/code&gt;”):&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;(define-syntax (while stx)
  (define subs (syntax-&amp;gt;list stx))
  (datum-&amp;gt;syntax
   stx
   `(let loop ()
      (when ,(cadr subs)
        ,@(cddr subs)
        (loop)))
   stx))&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;which breaks like this:&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;(define x 2)
(let ([let 5])
  (while (&amp;lt; x 10)
    (printf &amp;quot;x = ~s\n&amp;quot; x)
    (set! x (add1 x))))&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;The problem is that all of those quoted names are getting the context of the user input, which is not the right thing (it's close to a &lt;code&gt;defmacro&lt;/code&gt;).  To fix this, you need to &lt;code&gt;quote-syntax&lt;/code&gt; all of these identifiers, so they'll have the macro source instead of the input source:&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;(define-syntax (while stx)
  (define subs (syntax-&amp;gt;list stx))
  (datum-&amp;gt;syntax
   stx
   `(,(quote-syntax let) ,(quote-syntax loop) ()
     (,(quote-syntax when) ,(cadr subs)
      ,@(cddr subs)
      (,(quote-syntax loop))))
   stx))&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;But that's clearly insane...  More than being tedious, it's still incorrect since all of those function application parens will have the user's lexical context (Racket has a special implicit &lt;code&gt;#%app&lt;/code&gt; macro that gets used in all function applications, and in this case the context of this application will make it unhygienic).  Instead of doing this, a better approach would be to create the resulting syntax with the lexical context of the macro source by changing just that argument:&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;(define-syntax (while stx)
  (define subs (syntax-&amp;gt;list stx))
  (datum-&amp;gt;syntax
   (quote-syntax here)
   `(let loop ()
      (when ,(cadr subs)
        ,@(cddr subs)
        (loop)))
   stx))&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;And that's simple again, and works fine now.&lt;/p&gt;&lt;p&gt;The problem is that it's tedious wrt to deconstructing the input (which happens to be trivial in this case), and wrt slapping together an output value — and that's where &lt;code&gt;syntax-case&lt;/code&gt; comes in.  It addresses the both by using pattern matching, where identifiers in patterns are bound as “syntax patterns”.  A new form is added — &lt;code&gt;syntax&lt;/code&gt; — which is similar to a &lt;code&gt;quote&lt;/code&gt;, except that (a) it actually quotes things similarly to &lt;code&gt;quote-syntax&lt;/code&gt;, with the lexical context of the &lt;code&gt;syntax&lt;/code&gt; form; and (b) pattern variables are substituted with what they matched.  With this, the above macro becomes much easier:&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;(define-syntax (while stx)
  (syntax-case stx ()
    [(_ test body ...)
     (syntax (let loop ()
               (when test
                 body ...
                 (loop))))]))&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;The first line specifies that you want to match the &lt;code&gt;stx&lt;/code&gt; input syntax, and that you have no “keywords” (in the same sense as in &lt;code&gt;syntax-rules&lt;/code&gt;).  The second line is the pattern that is matched against this input — with two pattern variables that match the second subexpression and the sequence of expressions from the third and on.  (The first subexpression is matched against &lt;code&gt;_&lt;/code&gt; which is a wild-card that matches anything without binding a pattern variable — the head part is often not needed, since it's just the macro name.)  The last line is the output, specified using &lt;code&gt;syntax&lt;/code&gt;, which means that it's very similar to the previous version where everything is given the lexical context of the macro and the two pattern variables are replaced with the two matches (so &lt;code&gt;body&lt;/code&gt; gets spliced into the resulting syntax).&lt;/p&gt;&lt;p&gt;Now, say that you want an unhygienic user-visible piece of syntax.  For example, bind the always entertaining &lt;code&gt;it&lt;/code&gt; thing to the test result.  This:&lt;blockquote&gt;&lt;pre&gt;(define-syntax (while stx)
  (syntax-case stx ()
    [(_ test body ...)
     (syntax (let loop ()
               (let ([it test])
                 (when it
                   body ...
                   (loop)))))]))&lt;/pre&gt;&lt;/blockquote&gt;won't work because &lt;code&gt;it&lt;/code&gt; has the macro source — it's hygienic and therefore not visible.  Instead, you need to use &lt;code&gt;datum-&amp;gt;syntax&lt;/code&gt; with the user syntax:&lt;blockquote&gt;&lt;pre&gt;(define-syntax (while stx)
  (syntax-case stx ()
    [(_ test body ...)
     (let ([it (datum-&amp;gt;syntax stx 'it)])
       (syntax (let loop ()
                 (let ([it test])
                   (when it
                     body ...
                     (loop))))))]))&lt;/pre&gt;&lt;/blockquote&gt;But this doesn't really work since &lt;code&gt;it&lt;/code&gt; needs to be bound as a pattern variable rather than a plain binding.  &lt;code&gt;syntax-case&lt;/code&gt; can be used here again: &lt;code&gt;(syntax-case &amp;lt;name&amp;gt; () [foo &amp;lt;body&amp;gt;])&lt;/code&gt; will match &lt;code&gt;foo&lt;/code&gt; against the &lt;code&gt;&amp;lt;name&amp;gt;&lt;/code&gt; syntax, and if it's a name then it will be bound as a pattern variable in the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;.&lt;blockquote&gt;&lt;pre&gt;(define-syntax (while stx)
  (syntax-case stx ()
    [(_ test body ...)
     (syntax-case (datum-&amp;gt;syntax stx 'it) ()
       [it (syntax (let loop ()
                     (let ([it test])
                       (when it
                         body ...
                         (loop)))))])]))&lt;/pre&gt;&lt;/blockquote&gt;Note that since &lt;code&gt;it&lt;/code&gt; is a pattern variable, it doesn't need to be unquoted — &lt;code&gt;syntax&lt;/code&gt; will do that.&lt;/p&gt;&lt;p&gt;Finally, there are some more conveniences.  First, &lt;code&gt;with-syntax&lt;/code&gt; is a macro that binds pattern variables (by a similar translation to &lt;code&gt;syntax-case&lt;/code&gt;):&lt;blockquote&gt;&lt;pre&gt;(define-syntax (while stx)
  (syntax-case stx ()
    [(_ test body ...)
     (with-syntax ([it (datum-&amp;gt;syntax stx 'it)])
       (syntax (let loop ()
                 (let ([it test])
                   (when it
                     body ...
                     (loop))))))]))&lt;/pre&gt;&lt;/blockquote&gt;and there's the &lt;code&gt;#'&lt;/code&gt; reader macro for &lt;code&gt;syntax&lt;/code&gt;:&lt;blockquote&gt;&lt;pre&gt;(define-syntax (while stx)
  (syntax-case stx ()
    [(_ test body ...)
     (with-syntax ([it (datum-&amp;gt;syntax stx 'it)])
       #'(let loop ()
           (let ([it test])
             (when it
               body ...
               (loop)))))]))&lt;/pre&gt;&lt;/blockquote&gt;and there are also &lt;code&gt;#`&lt;/code&gt; and &lt;code&gt;#,&lt;/code&gt; and &lt;code&gt;#,@&lt;/code&gt; which are implemented by translating them to uses of &lt;code&gt;with-syntax&lt;/code&gt;.&lt;/p&gt;&lt;p&gt;Note that the last example uses the lexical context of the whole form for the new identifier, but that's not only the option.  You could use any other part of the macro input — for example, you could use the macro keyword:&lt;blockquote&gt;&lt;pre&gt;(define-syntax (while stx)
  (syntax-case stx ()
    [(hd test body ...) ; need the head now
     (with-syntax ([it (datum-&amp;gt;syntax #'hd 'it)])
       ... same ...)]))&lt;/pre&gt;&lt;/blockquote&gt;or the test expression (use &lt;code&gt;#'test&lt;/code&gt;).  Each of these choices has subtle differences that are especially important when you're composing macros (for example, using a second macro that &lt;em&gt;expands&lt;/em&gt; to a &lt;code&gt;while&lt;/code&gt;, where the test expression comes from that macro rather than the user code).  Demonstrating these things is a popular way to pass the time in some circles, but I'll avoid it here.  In fact, a great way to avoid this whole thing altogether is not create unhygienic bindings in the first place.  It sounds like doing so excludes cases where you &lt;em&gt;really&lt;/em&gt; want to have a new binding visible in user code, but racket provides “syntax parameters” that can be used more conveniently (and less confusingly) — see &lt;a href="http://blog.racket-lang.org/2008/02/dirty-looking-hygiene.html"&gt;an earlier post&lt;/a&gt; for a description of that.  As a side note, these options are a good hint that a hygienic macro system is more expressive than a symbolic &lt;code&gt;defmacro&lt;/code&gt; system, where no such choices exist.  Creating such macros using &lt;code&gt;defmacro&lt;/code&gt; can appear easier simply because of this lack of choice — in the same way that CPP-style string-based macros are “simpler” than &lt;code&gt;defmacro&lt;/code&gt; since they're less expressive (just appending lexical tokens, no structural information).&lt;/p&gt;&lt;p&gt;There are other important aspects of the Racket macro system that are not covered here.  The most obvious of them is worth mentioning here: Racket separates the “runtime phase” from the “syntax phase”.  For example, if you want to try these examples with “&lt;code&gt;#lang racket/base&lt;/code&gt;”, you'll need to add &lt;code&gt;(require (for-syntax racket/base))&lt;/code&gt; since the &lt;code&gt;racket/base&lt;/code&gt; language doesn't have a full language in its syntax phase.&lt;/p&gt;&lt;p&gt;Roughly speaking, this makes sure that source code is deterministically compilable by having each level live in its own world, limiting macros to deal only with the input syntax only and not runtime values.  (For example, a CLOS implementation in this system cannot check the value of an identifier bound to a class to determine how some macro should expand.)  This results in reliable compilations that do not depend on how things were loaded, or whatever happened on the REPL.&lt;/p&gt;&lt;p&gt;The important bottom line here is that you get to write macros with the full language available — and phase separation means that Racket is explicitly designed to make running code at the macro level and using it by the compiler as robust as possible, so you don't have to worry about using any complex system as part of your macro.  You just need to keep in mind that the macro world is completely separate from the runtime, and the direct benefit of not worrying about weird interactions with compilation and file loading orders.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-1248551246168499369?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/1248551246168499369/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=1248551246168499369' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1248551246168499369'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1248551246168499369'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2011/04/writing-syntax-case-macros.html' title='Writing ‘syntax-case’ Macros'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-2251597477702098360</id><published>2011-03-19T10:58:00.001-04:00</published><updated>2011-03-22T22:02:06.912-04:00</updated><title type='text'>Languages as Libraries, PLDI 2011</title><content type='html'>&lt;p&gt;We've just finished up the &lt;a href="http://bit.ly/langlib"&gt;final version&lt;/a&gt; of our &lt;a href="http://pldi11.cs.utah.edu/"&gt;PLDI 2011&lt;/a&gt; paper on language extension in Racket.  The paper describes how the module system and the syntax system work together to support new languages with new static semantics, such as Typed Racket.  Here's the abstract:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Programming language design benefits from constructs for extending the syntax and semantics of a host language.  While C's string-based macros empower programmers to introduce notational shorthands, the parser-level macros of Lisp encourage experimentation with domain-specific languages.  The Scheme programming language improves on Lisp with macros that respect lexical scope.&lt;/p&gt;&lt;p&gt;The design of Racket—a descendant of Scheme—goes even further with the introduction of a full-fledged interface to the static semantics of the language.  A Racket extension programmer can thus add constructs that are indistinguishable from “native” notation, large and complex embedded domain-specific languages, and even optimizing transformations for the compiler backend.  This power to experiment with language design has been used to create a series of sub-languages for programming with first-class classes and modules, numerous languages for implementing the Racket system, and the creation of a complete and fully integrated typed sister language to Racket's untyped base language.&lt;/p&gt;&lt;p&gt;This paper explains Racket's language extension API via an implementation of a small typed sister language.  The new language provides a rich type system that accommodates the idioms of untyped Racket. Furthermore, modules in this typed language can safely exchange values with untyped modules.  Last but not least, the implementation includes a type-based optimizer that achieves promising speedups.  Although these extensions are complex, their Racket implementation is just a library, like any other library, requiring no changes to the Racket implementation.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;To learn how to implement your own new language in Racket, start with &lt;a href="http://docs.racket-lang.org/guide/languages.html"&gt;this documentation&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-2251597477702098360?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/2251597477702098360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=2251597477702098360' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2251597477702098360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2251597477702098360'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2011/03/languages-as-libraries-pldi-2011.html' title='Languages as Libraries, PLDI 2011'/><author><name>Sam Tobin-Hochstadt</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-2611063075276519104</id><published>2011-02-14T22:52:00.000-05:00</published><updated>2011-11-09T22:50:37.942-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>Racket v5.1</title><content type='html'>Racket version 5.1 is now available from&lt;pre&gt;  &lt;a href="http://racket-lang.org/"&gt;http://racket-lang.org/&lt;/a&gt;&lt;/pre&gt;&lt;p&gt;The most significant change in version 5.1 is a &lt;a href="http://blog.racket-lang.org/2010/12/racket-version-5.html"&gt;rewrite of the GUI library&lt;/a&gt;.  Unix/X users will see the biggest difference with this change, because DrRacket and all Racket GUI programs now take on the desktop theme for menus, buttons, and other GUI widgets.&lt;/p&gt;&lt;p&gt;In the long run, Racket GUI programs on all platforms will improve as a result of the library rewrite.  In the short run, beware that this first release of a new library will inevitably include a new set of bugs.&lt;/p&gt;&lt;p&gt;Version 5.1 changes in more detail:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;The &lt;tt&gt;racket/draw&lt;/tt&gt; library&amp;mdash;which implements the drawing half the GUI toolkit&amp;mdash;can be used independent of the &lt;tt&gt;racket/gui/base&lt;/tt&gt; library and without a graphics display (e.g., without an X11 connection).&lt;br&gt;The new library has one small incompatibility with the old GUI toolbox: 'xor drawing is no longer supported.  The new library has many additional features: rotation and general affine transformations, PDF and SVG drawing contexts, gradients, and alpha-channel bitmaps.&lt;/li&gt;&lt;li&gt;The GRacket executable is no longer strictly necessary for running GUI programs, because the &lt;tt&gt;racket/gui/base&lt;/tt&gt; library can be used from Racket.  To the degree that a platform distinguishes GUI and console applications, however, the GRacket executable still offers some additional GUI-specific functionality (e.g., single-instance support).&lt;br&gt;The new &lt;tt&gt;racket/gui/base&lt;/tt&gt; library includes small incompatibilities with the old GUI toolbox: the &lt;tt&gt;send-event&lt;/tt&gt;, &lt;tt&gt;current-ps-afm-file-paths&lt;/tt&gt;, and &lt;tt&gt;current-ps-cmap-file-paths&lt;/tt&gt; functions have been removed.  The &lt;tt&gt;racket/gui/base&lt;/tt&gt; library re-exports &lt;tt&gt;racket/draw&lt;/tt&gt;, so it includes the same drawing functionality as before (except for 'xor drawing).&lt;/li&gt;&lt;li&gt;The new &lt;tt&gt;racket/snip&lt;/tt&gt; library can be used independently of &lt;tt&gt;racket/gui/base&lt;/tt&gt; to work with graphical editor content (e.g., images in student programs).  Like &lt;tt&gt;racket/draw&lt;/tt&gt;, the &lt;tt&gt;racket/snip&lt;/tt&gt; library is re-exported by &lt;tt&gt;racket/gui/base&lt;/tt&gt;.&lt;/li&gt;&lt;li&gt;The Web Server includes a backwards incompatible change that prevents X-expressions and lists of bytes from being directly returned from servlets.  This change will increase performance for those types of responses and allow easier experimentation with response types.  Please see "&lt;tt&gt;collects/web-server/compat/0/README&lt;/tt&gt;" in the installation to learn about porting your servlets forward. Don't worry.  It's easy.&lt;/li&gt;&lt;li&gt;The new &lt;tt&gt;raco demodularize&lt;/tt&gt; tool collapses a module's dependencies into a single module comprising the whole program.  This transformation currently provides no performance improvement, but is the basis for cross-module optimization and dead-code elimination tools to come.  The transformation is currently useful for static analysis of whole Racket programs.&lt;/li&gt;&lt;li&gt;The picturing-programs teachpack, formerly installed via PLaneT, is now bundled with the standard distribution.  Use the teachpack with &lt;tt&gt;(require picturing-programs)&lt;/tt&gt; instead of &lt;tt&gt;(require installed-teachpacks/picturing-programs)&lt;/tt&gt;.  The old PLaneT-based installation procedure still works, but it now merely installs a stub that invokes the bundled version.&lt;/li&gt;&lt;li&gt;Slideshow picts, &lt;tt&gt;racket/draw&lt;/tt&gt; bitmaps, and images created with &lt;tt&gt;2htdp/image&lt;/tt&gt; can now be used directly in Scribble documents.  More generally, the new &lt;tt&gt;file/convertible&lt;/tt&gt; protocol enables any value that is convertible to a PNG and/or PDF stream to be used as an image in a Scribble document.&lt;/li&gt;&lt;li&gt;The Same game sports a new look and an improved scoring system.  (The current known high score is 12,429; can you beat that?)&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-2611063075276519104?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://racket-lang.org/' title='Racket v5.1'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/2611063075276519104/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=2611063075276519104' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2611063075276519104'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2611063075276519104'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2011/02/racket-v51.html' title='Racket v5.1'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-149573500831144101</id><published>2010-12-08T10:59:00.005-05:00</published><updated>2010-12-08T11:15:38.590-05:00</updated><title type='text'>Rebuilding Racket’s Graphics Layer</title><content type='html'>&lt;p&gt;Racket version 5.1, which is scheduled for release in early February, will look a little different on the outside. Unix/X users will see the biggest difference: DrRacket and all Racket GUI programs will take on the desktop theme for menus, buttons, and other GUI widgets. Text handling is also better than before on Unix/X, especially when printing. Windows and Mac OS X users will see smaller changes, such as better printing, better handling of mouse-wheel events, and support for 64-bit Windows and Mac OS X.&lt;/p&gt;


&lt;p&gt;On the inside, version 5.1 is the biggest single change in Racket (or PLT Scheme) history. We’ve reimplemented the GUI layer, which meant throwing out about 200,000 lines of C++ code that built on Xt, Win32, and Carbon. We’ve replaced that C++ code with about 30,000 lines of Racket code that builds on Gtk, Win32, Cocoa, Cairo, and Pango. This change modernizes Racket's graphics support while significantly reducing the cost of maintaining the GUI and drawing libraries.&lt;/p&gt;


&lt;p&gt;
In the space between the GUI implementation and the surface, there are many API improvements:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt; You can run GUI programs with just &lt;tt&gt;racket&lt;/tt&gt;, instead of having to use &lt;tt&gt;gracket&lt;/tt&gt;. Depending on how much your platform distinguishes between GUI and console applications, there may still be an advantage to using &lt;tt&gt;gracket&lt;/tt&gt; (i.e., to tell the OS that you mean to start a GUI application or that you want a single instance of the application), but the difference is minor.&lt;/li&gt;
&lt;li&gt;  Most of the drawing library has moved to &lt;tt&gt;racket/draw&lt;/tt&gt;, which you can use without the rest of the GUI library – and, in the case of Unix platforms, without an X-server connection. After detangling the graphics and GUIs libraries, the graphics library is now integrated in more places, such as adding pict support for Scribble documents. &lt;/li&gt;
&lt;li&gt; The drawing library includes some new capabilities, such as rotation, affine transformations, and bitmaps with alpha channels.&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;Replacing hundreds of thousands of lines of C++ code with tens of thousands of lines of Racket code sounds like a no-brainer. The old library was implemented in C++ because we started in 1995 by gluing together a Scheme interpreter with a portable GUI library. Then the GUI code stayed in C++, because the interpreter wasn’t fast enough and the foreign interface was too clumsy. Racket is now plenty fast and its foreign interface has improved a lot since then.&lt;/p&gt;

&lt;p&gt;Still, the reimplementation took about 18 months. Smoothly integrating cross-platform GUI support with a programming language can be more difficult than it sounds, and mating new libraries with a legacy API creates additional challenges. Finally, many Racket tools depend Racket’s “eventspaces,” which are multiple process-like entities in the same virtual machine, each with its own GUI event loop. Implementing eventspaces on top of modern GUI toolkits turns out to be tricky, because the toolkits insist on a single event-loop per process and they cannot tolerate event-loop actions during certain callbacks. Fortunately, delimited continuations can help work around those limitations.&lt;/p&gt;


&lt;p&gt;Cairo and Pango are the two big enablers of the Racket graphics rewrite. The old Racket graphics library depended on many toolkits (X11, Win32, QuickDraw, Quartz, PostScript, and more), and it had poor font handling. Again, the problem was that we chose the previous technology in 1995. Cairo and Pango have since solved the portable-graphics problem, and we were able to trade in 80,000 lines of C++ glue for about 8,000 lines of Racket glue. The code could be much less if we didn’t have to match most of the old drawing API, but we're still very happy with the result.&lt;/p&gt;


&lt;p&gt;On the GUI side, the remaining 22,000 lines of Racket code replace similar C++ code that binds to three different toolkits. The set of underlying toolkits has changed, and a few eventspace tricks are new, but the approach is essentially the same as before. The code is nevertheless much more compact, because (no surprise) Racket is better than C++. Interestingly, the amount of toolkit-specific code is right around 6,500 lines for each toolkit, even though the way that a C programmer uses the different toolkits seems very different: Objective-C classes (Cocoa) versus signal callbacks with explicit wiring (Gtk) versus a single callback function for message handling (Win32). Maybe they're the same because we built a Racket mini-language for each toolkit that makes them all about equally convenient.&lt;/p&gt;


&lt;p&gt;The rewrite is not perfectly compatible with old code, and no doubt we have many bugs to find before the release. The process is well on track, though, and the new library implementations give a us a solid foundation to keep making Racket better.&lt;/p&gt;


&lt;p&gt;
To try out the current development version, visit&lt;/p&gt;

&lt;div style="text-align: center;"&gt;&lt;a href="http://pre.racket-lang.org/installers"&gt;http://pre.racket-lang.org/installers
&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-149573500831144101?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/149573500831144101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=149573500831144101' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/149573500831144101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/149573500831144101'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2010/12/racket-version-5.html' title='Rebuilding Racket’s Graphics Layer'/><author><name>Matthew Flatt</name><uri>http://www.blogger.com/profile/03369511886823036667</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-6894296804689956913</id><published>2010-11-07T01:33:00.000-04:00</published><updated>2011-11-09T22:50:37.959-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>Racket v5.0.2</title><content type='html'>Racket version 5.0.2 is now available from&lt;pre&gt;  &lt;a href="http://racket-lang.org/"&gt;http://racket-lang.org/&lt;/a&gt;&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;Typed Racket's optimizer is now turned on by default; error messages have been simplified and clarified.&lt;/li&gt;&lt;li&gt;Contracts: contracts on mutable containers allow functions or other higher order values, and contracts are checked when updating or dereferencing the containers.  The new contracts are slower than the old ones, so the old check-once functionality is still available.&lt;br&gt;A new dependent function contract combinator, &lt;tt&gt;-&gt;i&lt;/tt&gt;, properly assigns blame for contracts that violate themselves and the generated wrappers are more efficient than &lt;tt&gt;-&gt;d&lt;/tt&gt;.  (Although it does more checking so your contracts may be faster or slower).&lt;br&gt;See the docs for &lt;tt&gt;box/c&lt;/tt&gt;, &lt;tt&gt;hash/c&lt;/tt&gt;, &lt;tt&gt;vector/c&lt;/tt&gt;, &lt;tt&gt;vectorof&lt;/tt&gt; and &lt;tt&gt;-&gt;i&lt;/tt&gt; for more details.&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;when&lt;/tt&gt;, &lt;tt&gt;unless&lt;/tt&gt;, &lt;tt&gt;cond&lt;/tt&gt;, &lt;tt&gt;case&lt;/tt&gt;, and &lt;tt&gt;match&lt;/tt&gt; forms (in &lt;tt&gt;racket/base&lt;/tt&gt; and derived languages) now allow immediate internal definitions.&lt;/li&gt;&lt;li&gt;Web server: the formlets library provides more HTML form elements; &lt;tt&gt;make-xexpr-response&lt;/tt&gt; supports a preamble for DTD declarations; &lt;tt&gt;serve/servlet&lt;/tt&gt; supports stateless servlets.&lt;/li&gt;&lt;li&gt;New WebSocket implementation, see &lt;tt&gt;net/websocket&lt;/tt&gt; for details.&lt;/li&gt;&lt;li&gt;The new &lt;tt&gt;data&lt;/tt&gt; collection contains implementations of several data structures, including growable vectors and order-based dictionaries.&lt;/li&gt;&lt;li&gt;&lt;tt&gt;racket/match&lt;/tt&gt; is now significantly faster.&lt;/li&gt;&lt;li&gt;The Racket documentations are built in parallel by default.&lt;/li&gt;&lt;li&gt;The stepper is now compatible with programs using the Universe teachpack.&lt;/li&gt;&lt;li&gt;&lt;tt&gt;2htdp/image&lt;/tt&gt;: pinholes are now supported in the library (if you don't use pinhole primitives you will not see them); a number of new triangle functions added; supports conversion of images to color lists and back.  Also, cropping has been improved for scenes; see the documentation section on the nitty-gritty of pixels for details.&lt;/li&gt;&lt;li&gt;Signatures have been moved to ASL, BSL, BSL+, ISL, and ISL+ (HtDP teaching languages) no longer support checked signatures.&lt;/li&gt;&lt;li&gt;Student languages: one-armed &lt;tt&gt;check-error&lt;/tt&gt; in all levels; ASL is extended with hash operations, and &lt;tt&gt;define-datatype&lt;/tt&gt;.&lt;/li&gt;&lt;li&gt;DMdA languages: Checking for parametric signatures is now eager.  This catches errors earlier, but retains the asymptotic complexity properties; signatures for record types now have generators; &lt;tt&gt;list-of&lt;/tt&gt; and &lt;tt&gt;any&lt;/tt&gt; signatures are now provided.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-6894296804689956913?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://racket-lang.org/' title='Racket v5.0.2'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/6894296804689956913/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=6894296804689956913' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/6894296804689956913'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/6894296804689956913'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2010/11/racket-v502.html' title='Racket v5.0.2'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-1382320702984482359</id><published>2010-10-03T00:57:00.000-04:00</published><updated>2010-10-03T00:57:36.308-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oopsla'/><category scheme='http://www.blogger.com/atom/ns#' term='papers'/><category scheme='http://www.blogger.com/atom/ns#' term='web-server'/><title type='text'>The Two-State Solution: Native and Serializable Continuations Accord</title><content type='html'>&lt;p&gt;The Racket Web Server allows an expressive way of writing Web applications using first-class continuations to capture the control-flow of the server while it is waiting for the client to respond. For example:&lt;/p&gt;
&lt;pre&gt;
#lang web-server/insta
(define (get-number p)
  (string-&gt;number
   (extract-binding/single
    'num
    (request-bindings
     (send/suspend
      (λ (k-url)
        `(html 
          (body
           (form ([action ,k-url])
                 ,p nbsp (input ([name "num"]))
                 (input ([type "submit"])))))))))))
(define (start req)
  (define how-many
    (get-number "How many numbers to add?"))
  (number-&gt;string
   (foldr 
    + 0
    (build-list 
     how-many
     (λ (i)
       (get-number 
        (format "Provide number: ~a" 
                (add1 i))))))))
&lt;/pre&gt;

&lt;p&gt;This application creates a re-usable &lt;code&gt;get-number&lt;/code&gt; interaction abstraction and uses it in a number of different contexts. In particular, it uses it in the higher-order context of &lt;code&gt;build-list&lt;/code&gt;. This application also reuses useful third-party library functions like &lt;code&gt;foldr&lt;/code&gt;, etc.&lt;/p&gt;

&lt;p&gt;Such an application would be complicated to write in a traditional Web programming environment because the continuation of each &lt;code&gt;get-number&lt;/code&gt; invocation is considerably more complex than is typical. Yet, the first-class continuations in Racket ensure that this continuation is captured exactly, correctly, every time.&lt;/p&gt;

&lt;p&gt;Unfortunately, the native first-class continuations of Racket are not serializable, so they impose a per-session resource expenditure on the server. This can be alleviated through &lt;a href="http://docs.racket-lang.org/web-server/servlet.html#(part._managers)"&gt;expiration policies&lt;/a&gt;, but such policies are inherently unsound because continuations URLs are global roots.&lt;/p&gt;

&lt;p&gt;In the past, PLT has &lt;a href="http://cs.brown.edu/~sk/Publications/Papers/Published/mfgkf-web-restructuring-cps-journal/"&gt;provided tools&lt;/a&gt; that automatically restructure this kind of program into one that uses serializable continuations through an acronym soup of source transformations: CPS, lambda-lifting, defunctionalization, SPS, and so on. These tools effectively create automatically what most Web programmers write manually, except the tools don't mistakes.  But the tools also don't take into consideration what functions actually contribute to the interaction context and transform library functions like &lt;code&gt;foldr&lt;/code&gt; (which is unnecessary in the continuation) the same as functions like &lt;code&gt;build-list&lt;/code&gt; (which &lt;em&gt;are&lt;/em&gt; necessary.)&lt;/p&gt;

&lt;p&gt;Our &lt;a href="http://faculty.cs.byu.edu/~jay/static/icfp065-mccarthy.pdf"&gt;past work&lt;/a&gt; (based on &lt;a href="http://cs.brown.edu/~sk/Publications/Papers/Published/pcmkf-cont-from-gen-stack-insp/"&gt;another PLT paper&lt;/a&gt;) alleviates this problem by only requiring functions like &lt;code&gt;build-list&lt;/code&gt; to be transformed. From the perspective of a programmer, "transformed" is tantamount to "rewritten" because the source code for a third-party library may not be readily available. Programmers would have to program &lt;code&gt;add-many-numbers.com&lt;/code&gt; as:&lt;/p&gt;
&lt;pre&gt;
#lang web-server
(require web-server/servlet-env)
(define (get-number p)
  (string-&gt;number
   (extract-binding/single
    'num
    (request-bindings
     (send/suspend
      (λ (k-url)
        `(html 
          (body
           (form ([action ,k-url])
                 ,p nbsp (input ([name "num"]))
                 (input ([type "submit"])))))))))))
(define (build-list n f)
  (for/list ([i (in-range n)])
    (f i)))
(define (start req)
  (define how-many
    (get-number "How many numbers to add?"))
  (number-&gt;string
   (foldr 
    + 0
    (build-list
     how-many
     (λ (i)
       (get-number 
        (format "Provide number: ~a"
                (add1 i))))))))
; This requires a pre-release version
; to run in an un-named DrRacket buffer
(serve/servlet start #:stateless? #t)
&lt;/pre&gt;
&lt;p&gt;where &lt;code&gt;build-list&lt;/code&gt; has been re-implemented, but functions like &lt;code&gt;foldr&lt;/code&gt; have not. This application, despite its striking similarity to the first, requires absolutely no per-session server state, so it is considerably more scalable.&lt;/p&gt;

&lt;p&gt;Do we need to re-implement &lt;code&gt;build-list&lt;/code&gt;? What if the third-party, higher-order function (&lt;code&gt;build-list&lt;/code&gt;) that we use with a higher-order argument that causes Web interaction (&lt;code&gt;get-number&lt;/code&gt;) is too complicated to re-implement?&lt;/p&gt;
 
&lt;p&gt;Naturally this blog post would not exist if we didn't solve this problem.&lt;/p&gt;

&lt;p&gt;Our new approach, dubbed &lt;cite&gt;The Two-State Solution&lt;/cite&gt;, allows the programmer to transparently use a very small amount of per-session server state to store &lt;em&gt;just&lt;/em&gt; the part of the continuation inside functions like &lt;code&gt;build-list&lt;/code&gt; while serializing everything else to the client.&lt;/p&gt;

&lt;p&gt;The key is to use &lt;a href="http://docs.racket-lang.org/reference/eval-model.html#(part._prompt-model)"&gt;delimited, composable continuations&lt;/a&gt; to isolate the appropriate part of the continuation. The programmer designates this piece of the continuation through the &lt;code&gt;serial-&gt;native&lt;/code&gt; and &lt;code&gt;native-&gt;serial&lt;/code&gt; annotations. The programmer can write the application as:&lt;/p&gt;
&lt;pre&gt;
#lang web-server
(require web-server/servlet-env)
(define (get-number p)
  (string-&gt;number
   (extract-binding/single
    'num
    (request-bindings
     (send/suspend
      (λ (k-url)
        `(html 
          (body
           (form ([action ,k-url])
                 ,p nbsp (input ([name "num"]))
                 (input ([type "submit"])))))))))))
(define (start req)
  (define how-many
    (get-number "How many numbers to add?"))
  (number-&gt;string
   (foldr 
    + 0
    (serial-&gt;native
     (build-list
      how-many
      (λ (i)
        (native-&gt;serial
         (get-number 
          (format "Provide number: ~a"
                  (add1 i))))))))))
; This requires a pre-release version
; to run in an un-named DrRacket buffer
(serve/servlet start #:stateless? #t)
&lt;/pre&gt;
&lt;p&gt;The important distinction here is that both the &lt;code&gt;build-list&lt;/code&gt; and the &lt;code&gt;get-number&lt;/code&gt; abstractions do not need to change. We simply mark the context as being a "serial" or "native" context through the annotation forms. This re-written version will be more scalable than a purely native version, but represents an easier to achieve step in the evolution of a program, because third-party, higher-order functions can be used as is.&lt;/p&gt;

&lt;p&gt;This work will be presented at &lt;a href="http://splashcon.org/index.php?option=com_content&amp;amp;view=article&amp;amp;id=122&amp;amp;Itemid=91"&gt;OOPSLA 2010&lt;/a&gt;. It is also described in a paper with same name this blog post:&amp;nbsp;&lt;a href="http://faculty.cs.byu.edu/~jay/static/oopsla026-mccarthy.pdf"&gt;The Two-State Solution: Native and Serializable Continuations Accord&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-1382320702984482359?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://faculty.cs.byu.edu/~jay/static/oopsla026-mccarthy.pdf' title='The Two-State Solution: Native and Serializable Continuations Accord'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/1382320702984482359/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=1382320702984482359' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1382320702984482359'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1382320702984482359'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2010/10/two-state-solution-native-and.html' title='The Two-State Solution: Native and Serializable Continuations Accord'/><author><name>Jay McCarthy</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-13KUDv8LhZw/AAAAAAAAAAI/AAAAAAAAAAA/7MdiB5POU5k/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-3502770032653104859</id><published>2010-09-15T15:34:00.001-04:00</published><updated>2010-09-16T09:01:31.376-04:00</updated><title type='text'>Extending Typed Racket, Part 1</title><content type='html'>The Typed Racket team is pleased to announce a number of new additions
to our system.   We'll be writing a few blog posts about them, all of
which you can read here.
&lt;br /&gt;
This post begins with the core of the Typed Racket type system.
The fundamental idea at the heart of Typed Racket is called &lt;i&gt;occurrence
typing&lt;/i&gt;.  This is the technique that allows us to typecheck
existing Racket programs without requiring rewrites.  Here's a simple
example:
&lt;br /&gt;
&lt;pre&gt;(if (number? x) (add1 x) 0)
&lt;/pre&gt;

The typechecker can figure out from the use of &lt;code&gt;number?&lt;/code&gt;
that the second &lt;i&gt;occurrence&lt;/i&gt; of &lt;code&gt;x&lt;/code&gt; is always going to be a
number.  This simple form of occurrence typing is enough to take Typed
Racket a long way.  But because we want to be able to handle all the
sophisticated reasoning that programmers are already using to write
their Racket programs, we have been working on extending the system
further.&lt;br /&gt; 
The new design of our system is described in a paper, &lt;a href="http://www.ccs.neu.edu/scheme/pubs/#icfp10-thf"&gt;Logical Types for Untyped Languages&lt;/a&gt;, in
the upcoming International Conference on Functional Programming.  The
introduction provides an overview that's acessible to any Racket
programmer, but here's the key example:
&lt;br /&gt;
&lt;pre&gt;(cond
  [(and (number? x) (string? y)) — 1 —]
  [(number? x)                   — 2 —]
  [else                          — 3 —])
&lt;/pre&gt;

In expression 1, we know that &lt;code&gt;x&lt;/code&gt; is a number and
&lt;code&gt;y&lt;/code&gt; is a string.  In 2, we know that &lt;code&gt;x&lt;/code&gt; is a
number and &lt;code&gt;y&lt;/code&gt; is &lt;emph&gt;not&lt;/emph&gt; a string, by the logical
properties of &lt;code&gt;and&lt;/code&gt; and &lt;code&gt;cond&lt;/code&gt;.  This form of
logical reasoning is enabled by the new foundation of the system, and
makes the entire system significantly more expressive.  
&lt;br /&gt;
All of these improvements are available in the current version of
Racket.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-3502770032653104859?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/3502770032653104859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=3502770032653104859' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/3502770032653104859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/3502770032653104859'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2010/09/extending-typed-racket-part-1.html' title='Extending Typed Racket, Part 1'/><author><name>Sam Tobin-Hochstadt</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-6909673633196173269</id><published>2010-08-03T22:36:00.000-04:00</published><updated>2011-11-09T22:50:37.963-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>Racket v5.0.1</title><content type='html'>Racket version 5.0.1 is now available from&lt;pre&gt;  &lt;a href="http://racket-lang.org/"&gt;http://racket-lang.org/&lt;/a&gt;&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;Datalog is a lightweight deductive database system with Racket integration.  It is now available in the &lt;tt&gt;datalog&lt;/tt&gt; collection and with &lt;tt&gt;#lang datalog&lt;/tt&gt;.&lt;/li&gt;&lt;li&gt;Racklog provides Prolog-style logic programming in Racket, adapted from Dorai Sitaram's Schelog package.  It is available in the &lt;tt&gt;racklog&lt;/tt&gt; collection and now as &lt;tt&gt;#lang racklog&lt;/tt&gt;.&lt;/li&gt;&lt;li&gt;By default &lt;tt&gt;make install&lt;/tt&gt; and &lt;tt&gt;raco setup&lt;/tt&gt; compile collections in parallel on all available processors.  (Use &lt;tt&gt;raco setup -j 1&lt;/tt&gt; to disable, if necessary.)&lt;/li&gt;&lt;li&gt;Changes (as part of 5.0) in the &lt;tt&gt;racket&lt;/tt&gt; language compared to the &lt;tt&gt;scheme&lt;/tt&gt; language: constructor-style printing, a &lt;tt&gt;struct&lt;/tt&gt; alternative to &lt;tt&gt;define-struct&lt;/tt&gt; that fits more naturally with &lt;tt&gt;match&lt;/tt&gt; and constructor-style printing, bytecode-dependency management via SHA-1 hashes instead of just timestamps (where the &lt;tt&gt;openssl/sha1&lt;/tt&gt; library provides the SHA-1 hash function), a reorganization of &lt;tt&gt;scheme/foreign&lt;/tt&gt; into &lt;tt&gt;ffi/unsafe&lt;/tt&gt; and associated libraries, and new printing functions &lt;tt&gt;eprintf&lt;/tt&gt; and &lt;tt&gt;displayln&lt;/tt&gt;.  Also, a generator from &lt;tt&gt;racket/generator&lt;/tt&gt; is required to have the form &lt;tt&gt;(generator () body ...)&lt;/tt&gt;, which supports a planned extension to let a generator accept arguments.&lt;/li&gt;&lt;li&gt;Changes to the &lt;tt&gt;racket&lt;/tt&gt; language (since 5.0): internal-definition positions allow mixing expressions with definitions, full continuations can escape past a continuation barrier, custodians can attempt to terminate subprocesses and subprocess groups (see &lt;tt&gt;current-subprocess-custodian-mode&lt;/tt&gt;, &lt;tt&gt;subprocess-group-enabled&lt;/tt&gt;), the JIT supports additional unboxing flonum operations and unsafe variants, &lt;tt&gt;ffi/unsafe&lt;/tt&gt; provides an asychronous-call mechanism to deal with foreign threads, a new "." modifier for format string directives (e.g., "~.s" and "~.a") limits the respective output to &lt;tt&gt;(error-print-width)&lt;/tt&gt; characters.&lt;/li&gt;&lt;li&gt;The core type system of Typed Racket has been substantially revised.  In particular, Typed Racket can now follow significantly more sophisticated reasoning about the relationships between predicates.  Additionally, Typed Racket now allows variable arity types in more places, allowing programmers to specify variable-arity lists.&lt;/li&gt;&lt;li&gt;We are working on an optimizing version of Typed Racket that takes advantage of type information for certain classes of programs. This project is a work in progress.  For those interested, see the documentation for &lt;tt&gt;#:optimized&lt;/tt&gt;.&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;web-server/formlets&lt;/tt&gt; library adds a &lt;tt&gt;formlet*&lt;/tt&gt; form that allows dynamic formlet construction, as opposed to &lt;tt&gt;formlet&lt;/tt&gt; which requires syntactic Xexprs and static formlets.  Several new library formlets are added.&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;syntax/parse&lt;/tt&gt; library has new support for matching literals at different phases using the &lt;tt&gt;#:phase&lt;/tt&gt; argument for literals and literal sets.&lt;/li&gt;&lt;li&gt;RackUnit now includes a GUI test runner as &lt;tt&gt;rackunit/gui&lt;/tt&gt;.&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;2htdp/image&lt;/tt&gt; library now includes &lt;tt&gt;flip-vertical&lt;/tt&gt; and &lt;tt&gt;flip-horizontal&lt;/tt&gt; operations that mirror images (vertically and horizontally).&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-6909673633196173269?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://racket-lang.org/' title='Racket v5.0.1'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/6909673633196173269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=6909673633196173269' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/6909673633196173269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/6909673633196173269'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2010/08/racket-v501.html' title='Racket v5.0.1'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-8429284126611343134</id><published>2010-06-07T14:50:00.004-04:00</published><updated>2011-11-09T22:50:37.970-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>Racket</title><content type='html'>PLT is happy to announce the release of Racket, available from
&lt;pre&gt;  &lt;a href="http://racket-lang.org/"&gt;&lt;tt&gt;http://racket-lang.org/&lt;/tt&gt;&lt;/a&gt;&lt;/pre&gt;
&lt;p&gt;With Racket, you can script command shells and web servers; you can quickly prototype animations and complex GUIs; regexps and threads are here to serve you.  To organize your systems, you can mix and match classes, modules or components.  Best of all, you start without writing down types.  If you later wish to turn your script into a program, equip your Racket modules with explicit type declarations as you wish.  And Racket doesn't just come as a typed variant; you can also write your modules in a purely functional and lazy dialect.&lt;/p&gt;
&lt;p&gt;Racket comes in so many flavors because Racket is much more than a standard scripting language or a plain programming language.  Racket supports language extensibility to an unequaled degree.  A Racket programmer knows that making up a new language is as easy as writing a new library.&lt;/p&gt;
&lt;p&gt;To help you start quickly, Racket includes batteries in all shapes and sizes, most importantly, extensive documentation and all kinds of libraries.&lt;/p&gt;
&lt;p&gt;Racket occupies a unique position between research and practice.  It inherits many major ideas from language research, among them type safety (when the type system says that x is a number, then at runtime it always is a number) and memory safety (when some memory is reclaimed by the garbage collector it is impossible to still have a reference to it).  At the same time, user demand governs rigid adherence to purely theoretical principles.&lt;/p&gt;
&lt;p&gt;Racket, formerly PLT Scheme, is a product of over 15 years of development.  Although Racket starts with a mature software base and an established user community, its new name reflects our view that this is just the beginning of Racket's evolution.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-8429284126611343134?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://racket-lang.org/' title='Racket'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/8429284126611343134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=8429284126611343134' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8429284126611343134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8429284126611343134'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2010/06/plt-is-happy-to-announce-release-of.html' title='Racket'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-2610566504959049790</id><published>2010-04-02T21:51:00.001-04:00</published><updated>2011-11-09T22:50:37.937-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>PLT Scheme v4.2.5</title><content type='html'>PLT Scheme version 4.2.5 is now available from&lt;pre&gt;  &lt;a href="http://plt-scheme.org/"&gt;&lt;tt&gt;http://plt-scheme.org/&lt;/tt&gt;&lt;/a&gt;&lt;/pre&gt;
&lt;ul&gt;&lt;li&gt;PLT now supports multi-core parallelism via futures.  Futures create tasks that run in parallel, as long as the tasks stay in the "fast path" of the runtime system.  For more information, see &lt;a href="http://docs.plt-scheme.org/guide/performance.html?q=future#%28part._effective-futures%29"&gt;the guide&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Our unit testing framework, schemeunit, is now included in the distribution.  A graphical test runner is available via &lt;tt&gt;schemeunit/gui&lt;/tt&gt;.&lt;/li&gt;&lt;li&gt;The support languages for the "Programming Languages: Application and Interpretation" textbook by Shriram Krishnamurthi are now part of PLT Scheme.  In addition the PLAI GC language comes with a random mutator generator (to help test collectors) and an improved heap visualizer.&lt;/li&gt;&lt;li&gt;New Russian and Ukranian translations, thanks to Sergey Semerikov.&lt;/li&gt;&lt;li&gt;A number of improvements to Redex's typesetting facilities.&lt;/li&gt;&lt;li&gt;Typed Scheme users can now automatically generate predicates from types with &lt;tt&gt;define-predicate&lt;/tt&gt;.  Typed code can be inserted in untyped modules by requiring &lt;tt&gt;with-type&lt;/tt&gt; from &lt;tt&gt;typed/scheme&lt;/tt&gt;.&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;scheme/class&lt;/tt&gt; library now provides contract combinators for classes (&lt;tt&gt;class/c&lt;/tt&gt;) and objects (&lt;tt&gt;object/c&lt;/tt&gt;).  See the Reference and Guide for details.  Also, a backwards-compatible &lt;tt&gt;object-contract&lt;/tt&gt; version of &lt;tt&gt;object/c&lt;/tt&gt; has replaced the old &lt;tt&gt;object-contract&lt;/tt&gt; combinator.&lt;/li&gt;&lt;li&gt;Writing new kinds of contracts is now easier with keyword-based constructors (&lt;tt&gt;make-contract&lt;/tt&gt; and &lt;tt&gt;make-flat-contract&lt;/tt&gt;), a simpler set of structure properties (&lt;tt&gt;prop:contract&lt;/tt&gt; and &lt;tt&gt;prop:flat-contract&lt;/tt&gt;), and the introduction of blame objects for tracking contract metadata.&lt;/li&gt;&lt;li&gt;The Scheme-implemented bytecode reader fails less often.  This is used by "mzc --decompile".  The Scheme-implemented bytecode writer uses the compact bytecode format and fails less often.  This may be used in the future for Scheme-implement bytecode processors.&lt;/li&gt;&lt;li&gt;The language dialog now suggests using "#lang" more strongly as the default language.  DrScheme no longer uses the term `Module language'.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-2610566504959049790?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://plt-scheme.org/' title='PLT Scheme v4.2.5'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/2610566504959049790/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=2610566504959049790' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2610566504959049790'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2610566504959049790'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2010/04/plt-scheme-v425.html' title='PLT Scheme v4.2.5'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-3811154831217235895</id><published>2010-03-08T11:35:00.006-05:00</published><updated>2010-03-08T12:22:43.990-05:00</updated><title type='text'>Talk at Flourish</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_gJUvnpacURg/S5UwRCtLiDI/AAAAAAAAAI0/9mdGDzmDD7k/s1600-h/langs.png"&gt;&lt;img style="float: right; margin: 0pt 0pt 10px 10px; cursor: pointer; width: 316px; height: 233px;" src="http://3.bp.blogspot.com/_gJUvnpacURg/S5UwRCtLiDI/AAAAAAAAAI0/9mdGDzmDD7k/s400/langs.png" alt="" id="BLOGGER_PHOTO_ID_5446312393716762674" border="0" /&gt;&lt;/a&gt;
&lt;p&gt;
The image in this post shows a tree where the interior nodes represent directories and the leaf nodes represent files in the PLT source code. The leaves are colored based on the programming language used. (To avoid clutter, if there is more than one file in a given directory written in a particular language, that language only gets a single dot.)
&lt;/p&gt;

&lt;p&gt;
Some highlights: the blues are Scheme-like languages, the reds are langauges we use to write documentation (see &lt;a href="http://docs.plt-scheme.org/scribble/"&gt;Scribble&lt;/a&gt; for more about them), the greens are teaching languages, orange is the language we use to bootstrap new languages, and yellow is a language for metadata about nearby files.
&lt;/p&gt;

&lt;p&gt;
Curious about how we managed to write and use so many different languages?
I'll be giving a talk at &lt;a href="http://www.flourishconf.com/flourish2010/"&gt;Flourish 2010&lt;/a&gt; next week (3/19 @11am, UIC in Chicago) explaining how. Come to learn more!
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-3811154831217235895?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/3811154831217235895/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=3811154831217235895' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/3811154831217235895'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/3811154831217235895'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2010/03/talk-at-flourish.html' title='Talk at Flourish'/><author><name>Robby</name><uri>http://www.blogger.com/profile/08402308775580442837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='13' height='32' src='http://people.cs.uchicago.edu/~robby/portrait-2006.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_gJUvnpacURg/S5UwRCtLiDI/AAAAAAAAAI0/9mdGDzmDD7k/s72-c/langs.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-8557185805751063148</id><published>2010-02-28T20:16:00.006-05:00</published><updated>2010-02-28T20:32:34.398-05:00</updated><title type='text'>DAGs vs Trees</title><content type='html'>&lt;p&gt;
As I wondering whether or not there is a better layout algorithm for the module browser window, I looked into &lt;a href="http://www.cs.umd.edu/hcil/treemap-history/"&gt;tree maps&lt;/a&gt;. Of course, the modules in a program form a DAG, not a tree, so I wondered just how big the tree would get if all of the shared structure in the DAG were replicated. Hey, I figured, if a tree map can handle showing me my entire filesystem, maybe that could work.
&lt;/p&gt;

&lt;p&gt;
... yeah, no. Turns out to be hopeless. In the spirit of a geeky take off on a jelly bean counting contest, lets see if you can guess just how big these things get. Consider the module graph from the program &lt;tt&gt;#lang scheme&lt;/tt&gt; (ie, the graph that just contains an empty program). This program loads 170 modules with 917 connections between modules (counting the main file that just contains the &lt;tt&gt;#lang scheme&lt;/tt&gt;).
&lt;/p&gt;

&lt;p&gt;
So, the question: how many nodes are there in the unsharified tree? First one to come within 1 billion of the right answer gets all of the fame and glory that this blog brings to bear (har har). I'll post the answer in the comments in a few days (and no fair cheating, those of you that know enough to be able to get your hands on the DAG).
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-8557185805751063148?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/8557185805751063148/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=8557185805751063148' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8557185805751063148'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8557185805751063148'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2010/02/dags-vs-trees.html' title='DAGs vs Trees'/><author><name>Robby</name><uri>http://www.blogger.com/profile/08402308775580442837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='13' height='32' src='http://people.cs.uchicago.edu/~robby/portrait-2006.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-8793911366542740014</id><published>2010-01-29T12:57:00.005-05:00</published><updated>2010-01-29T21:18:18.443-05:00</updated><title type='text'>Benchmarks</title><content type='html'>First, the usual disclaimer:

&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_KNUe0zbAbNc/S2MhtPN92xI/AAAAAAAAAAM/z7_pjgGoY4I/s1600-h/benchmark.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; display: block; cursor: pointer; width: 320px; height: 226px;" src="http://3.bp.blogspot.com/_KNUe0zbAbNc/S2MhtPN92xI/AAAAAAAAAAM/z7_pjgGoY4I/s320/benchmark.jpg" alt="" id="BLOGGER_PHOTO_ID_5432222636601891602" border="0" /&gt;&lt;/a&gt;
&lt;/div&gt;That said, I've run the latest version of PLT Scheme on two sets of benchmarks:
&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cs.utah.edu/%7Emflatt/benchmarks-20100126/log3/Benchmarks.html"&gt;Benchmarks in the PLT sources&lt;/a&gt; – vs. Bigloo, Chicken, Gambit, Guile, Ikarus, Larceny, MIT Scheme, and Scheme48; safe operations and generic arithmetic only
&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.cs.utah.edu/%7Emflatt/benchmarks-20100126/log1/Gambit_20benchmarks.html"&gt;Benchmarks in the Gambit sources&lt;/a&gt; – vs. Bigloo and Gambit; generic vs. fixnum-/flonum-specific arithmetic, safe vs. unsafe operations&lt;/li&gt;&lt;/ul&gt;The second set is why I started running benchmarks. Fixnum-/flonum-specific arithmetic and unsafe operations are new in PLT Scheme 4.2.4. The benchmark results suggest that the new operations in PLT Scheme offer roughly the same performance benefits as in Bigloo and Gambit. There's room for improvement, but it's a good first cut.


For the other results: PLT Scheme is rarely the fastest implementation on a given benchmark. For most purposes, though, it's in the same ballpark – except for programs that spend all their time capturing and invoking continuations.


It's fun to run benchmarks occasionally. Now, back to working on language design, libraries, documentation, usability...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-8793911366542740014?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/8793911366542740014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=8793911366542740014' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8793911366542740014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8793911366542740014'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2010/01/benchmarks.html' title='Benchmarks'/><author><name>Matthew Flatt</name><uri>http://www.blogger.com/profile/03369511886823036667</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_KNUe0zbAbNc/S2MhtPN92xI/AAAAAAAAAAM/z7_pjgGoY4I/s72-c/benchmark.jpg' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-8617297185333389454</id><published>2010-01-28T21:40:00.001-05:00</published><updated>2011-11-09T22:50:37.974-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>PLT Scheme v4.2.4</title><content type='html'>PLT Scheme version 4.2.4 is now available from&lt;pre&gt;  &lt;a href="http://plt-scheme.org/"&gt;&lt;tt&gt;http://plt-scheme.org/&lt;/tt&gt;&lt;/a&gt;&lt;/pre&gt;
&lt;ul&gt;&lt;li&gt;The &lt;tt&gt;scheme/flonum&lt;/tt&gt; and &lt;tt&gt;scheme/fixnum&lt;/tt&gt; libraries provide flonum- and fixnum-specific operations.  In the case of flonum-specific operations, the JIT compiler can recognize combinations of operations (including local bindings) and improve performance by "unboxing" intermediate results.&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;scheme/unsafe/ops&lt;/tt&gt; library provides arithmetic and other operations that are implemented without dynamic checks.  Avoiding checks can sometimes improve performance, but at the expense of safety.&lt;/li&gt;&lt;li&gt;&lt;tt&gt;2htdp/universe&lt;/tt&gt;: We have severed the connection between universe and an image library and made a few other, minor changes.  Most programs will now have to change to require the &lt;tt&gt;htdp/image&lt;/tt&gt; library explicitly.  For the full details, see the new &lt;a href="http://docs.plt-scheme.org/teachpack/2htdphtdp-port.html"&gt;Porting World Programs&lt;/a&gt; section of the documentation.&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;2htdp/image&lt;/tt&gt; library continues to grow.  In this release, it is supported by &lt;tt&gt;2htdp/universe&lt;/tt&gt;, equality changed to be based on how the images are drawn, cropping and curves were added, and support for more kinds of pens were added.&lt;/li&gt;&lt;li&gt;&lt;tt&gt;htdp/world&lt;/tt&gt;: The old world teachpack remains deprecated.  HtDP/2e exclusively uses the new 2htdp/universe library.  For backwards compatibility, the world teachpack will remain in the distribution until the coming summer.&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;scheme/class&lt;/tt&gt; library now provides &lt;tt&gt;this%&lt;/tt&gt;, which refers to the class of the current object (i.e. &lt;tt&gt;this&lt;/tt&gt;).&lt;/li&gt;&lt;li&gt;&lt;tt&gt;scheme/generator&lt;/tt&gt; has convenient functions for infinite generators, and for converting a generator to a sequence for iteration.&lt;/li&gt;&lt;li&gt;PLT Scheme's add-on directory can be customized by the &lt;tt&gt;$PLTADDONDIR&lt;/tt&gt; environment variable or &lt;tt&gt;--addon&lt;/tt&gt;/&lt;tt&gt;-A&lt;/tt&gt; command-line flags.  This controls where downloaded Planet packages and their compiled Scribble documentation are installed.&lt;/li&gt;&lt;li&gt;Additional extensions include: saving &lt;tt&gt;errno&lt;/tt&gt; in foreign calls, much improved &lt;tt&gt;sort&lt;/tt&gt; speed, normalized results from &lt;tt&gt;procedure-arity&lt;/tt&gt;, and more.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-8617297185333389454?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://plt-scheme.org/' title='PLT Scheme v4.2.4'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/8617297185333389454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=8617297185333389454' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8617297185333389454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8617297185333389454'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2010/01/plt-scheme-v424.html' title='PLT Scheme v4.2.4'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-8205870831316099176</id><published>2010-01-02T11:40:00.005-05:00</published><updated>2010-01-08T12:39:12.751-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scheme video'/><title type='text'>Scheme Videos (Lectures and Talks)</title><content type='html'>&lt;span class="Apple-style-span"   style="  ;font-family:arial, sans-serif;font-size:small;"&gt;&lt;p style="font-weight: bold; "&gt;Scheme Videos (Lectures and Talks)&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;(thanks to Geoffrey Knauth and Hari)&lt;/p&gt;&lt;p&gt;Following a mailing-list request, it turns out that there are quite a lot of Scheme-related lectures and talks floating around out there in video format. The following list was compiled by Geoffrey Knauth, with contributions from Hari and Michael Sperber.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;There's the SICP course Abelson &amp;amp; Sussman gave to [HP, I think] in the mid-1980s: &lt;a x="y" href="http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;MIT OCW / 6.001 using SICP, Spring 2005: &lt;a x="y" href="http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-001Spring-2005/VideoLectures/index.htm" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-001Spring-2005/VideoLectures/index.htm&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;All the ICFP 2009 videos (man this made my day!!): &lt;a x="y" href="http://vidiowiki.com/feature/list/fnu/ICFP_2009" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;http://&lt;/a&gt;&lt;a x="y" href="http://vidiowiki.com/feature/list/fnu/ICFP_2009" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;vidiowiki&lt;/a&gt;&lt;a x="y" href="http://vidiowiki.com/feature/list/fnu/ICFP_2009" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;.com/feature/list/&lt;/a&gt;&lt;a x="y" href="http://vidiowiki.com/feature/list/fnu/ICFP_2009" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;fnu&lt;/a&gt;&lt;a x="y" href="http://vidiowiki.com/feature/list/fnu/ICFP_2009" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;/&lt;/a&gt;&lt;a x="y" href="http://vidiowiki.com/feature/list/fnu/ICFP_2009" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;ICFP_2009&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Daniel P Friedman - A Celebration (this too!): &lt;a x="y" href="http://www.cs.indiana.edu/dfried_celebration.html" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;http://www.cs.indiana.edu/dfried_celebration.html&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;DrScheme v4.0 Tour: &lt;a x="y" href="http://www.youtube.com/watch?v=vgQO_kHl39g&amp;amp;fmt=18" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;http://www.youtube.com/watch?v=vgQO_kHl39g&amp;amp;fmt=18&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;Similar, if you understand Russian:&lt;/li&gt;&lt;li&gt;&lt;a x="y" href="http://www.youtube.com/watch?v=wECY7s9k-V0" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;http://www.youtube.com/watch?v=wECY7s9k-V0&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a x="y" href="http://www.youtube.com/watch?v=2CVJjqOT6WM" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;http://www.youtube.com/watch?v=2CVJjqOT6WM&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Matthias Felleisen - Programming at Northeastern: &lt;a x="y" href="http://www.savevid.com/video/matthias-felleisen-programming-at-northeastern-university.html" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;http://www.savevid.com/video/matthias-felleisen-programming-at-northeastern-university.html&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Matthew Flatt - Processes without Partitions: &lt;a x="y" href="http://www.researchchannel.org/prog/displayevent.aspx?rID=3892" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;http://www.researchchannel.org/prog/displayevent.aspx?rID=3892&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Shriram Krishnamurthi on WeScheme: &lt;a x="y" href="http://vidiowiki.com/watch/cydr9yk/" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;http://vidiowiki.com/watch/cydr9yk/&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Robby Findler - Macros Matter: &lt;a x="y" href="http://www.mefeedia.com/video/26348171" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;http://www.mefeedia.com/video/26348171&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Using PLT Scheme in the Game Industry: &lt;a x="y" href="http://www.youtube.com/watch?v=2CVJjqOT6WM" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;http://www.youtube.com/watch?v=2CVJjqOT6WM&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Stanford Lecture (Kawa): &lt;a x="y" href="http://www.youtube.com/watch?v=_cV8NWQCxnE" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;http://www.youtube.com/watch?v=_cV8NWQCxnE&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Bluetooth communication using PLT Scheme: &lt;a x="y" href="http://www.youtube.com/watch?v=pmR_dIXm6sY" target="_blank" style="font-family: arial, sans-serif; color: rgb(0, 62, 168); "&gt;http://www.youtube.com/watch?v=pmR_dIXm6sY&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span x="y"  style=" ;font-family:Helvetica;"&gt;SICP at UCB: &lt;/span&gt;&lt;a x="y" href="http://webcast.berkeley.edu/course_details.php?seriesid=1906978454" target="_blank" style="font-family: Helvetica; color: rgb(0, 62, 168); "&gt;http://webcast.berkeley.edu/course_details.php?seriesid=1906978454&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span"   style="  ;font-family:Helvetica;font-size:medium;"&gt;&lt;a href="http://www.aduni.org/courses/sicp/"&gt;http://www.aduni.org/courses/sicp/&lt;/a&gt; from ADUni by Holly Yanco. &lt;span class="Apple-style-span"  style=" ;font-family:Helvetica;"&gt;It comes with pretty good lecture notes and problem sets.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style="font-family:Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; "&gt;Michael Sperber's DMdA lectures (in German, natch): &lt;a href="http://timms.uni-tuebingen.de/List/List01.aspx?rpattern=UT_200[89]_____00[12]_info1_000_"&gt;http://timms.uni-tuebingen.de/List/List01.aspx?rpattern=UT_200[89]_____00[12]_info1_000_&lt;/a&gt; &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-8205870831316099176?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/8205870831316099176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=8205870831316099176' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8205870831316099176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8205870831316099176'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2010/01/scheme-videos-lectures-and-talks-thanks.html' title='Scheme Videos (Lectures and Talks)'/><author><name>John Clements</name><uri>http://www.blogger.com/profile/15701081040575095781</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-2650374273353885414</id><published>2009-12-07T13:18:00.002-05:00</published><updated>2009-12-07T14:10:20.655-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='futures'/><category scheme='http://www.blogger.com/atom/ns#' term='parallelism'/><title type='text'>Futures: Fine Grained Parallelism in PLT</title><content type='html'>&lt;p&gt;
We're pleased to announce the initial release of parallel futures, a
construct for fine-grained parallelism in PLT. Roughly speaking, a
programmer passes a thunk to 'future' and it gets run in parallel.
That "roughly" holds a few gotchas, partly because we're just getting
started and partly due to the technique we're using. See the
documentation for more details:
&lt;/p&gt;

&lt;center&gt;
&lt;a href="http://pre.plt-scheme.org/docs/html/futures/"&gt;http://pre.plt-scheme.org/docs/html/futures/&lt;/a&gt;
&lt;/center&gt;

&lt;p&gt;
If you've got a multicore machine where you can't keep the cores busy
or your office/machine room is a bit cold, try this program:

&lt;pre&gt;
#lang scheme
(require scheme/future)
(define (loop) (loop))
(for-each
 touch
 (for/list ([i (in-range 0 (processor-count))])
  (future loop)))
&lt;/pre&gt;

Note that you have to build mzscheme with futures; it isn't enabled by
default, but see the docs above for how to do that. Beyond the above,
we've also gotten a few parallel kernels going and are seeing good
scalability up to 8 cores (the biggest machine we have around for the
time being).
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-2650374273353885414?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/2650374273353885414/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=2650374273353885414' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2650374273353885414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2650374273353885414'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/12/futures-fine-grained-parallelism-in-plt.html' title='Futures: Fine Grained Parallelism in PLT'/><author><name>Robby</name><uri>http://www.blogger.com/profile/08402308775580442837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='13' height='32' src='http://people.cs.uchicago.edu/~robby/portrait-2006.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-5329605548581881880</id><published>2009-12-01T06:03:00.001-05:00</published><updated>2011-11-09T22:52:20.931-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>PLT Scheme v4.2.3</title><content type='html'>PLT Scheme version 4.2.3 is now available from&lt;pre&gt;  &lt;a href="http://plt-scheme.org/"&gt;&lt;tt&gt;http://plt-scheme.org/&lt;/tt&gt;&lt;/a&gt;&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;The unit test framework for the teaching languages provides &lt;tt&gt;check-member-of&lt;/tt&gt; and &lt;tt&gt;check-range&lt;/tt&gt; for checking "random functions", i.e., "functions" that may produce several different results for one and the same argument.&lt;/li&gt;&lt;li&gt;Added a new image library, &lt;tt&gt;2htdp/image&lt;/tt&gt;.  Significant changes from &lt;tt&gt;htdp/image&lt;/tt&gt;:&lt;ul&gt;&lt;li&gt;copying and pasting does not introduce jaggies&lt;/li&gt;&lt;li&gt;&lt;tt&gt;equal?&lt;/tt&gt; comparisons are more efficient&lt;/li&gt;&lt;li&gt;added rotation &amp;amp; scaling&lt;/li&gt;&lt;li&gt;got rid of pinholes (new overlay, beside, above functions based on bounding boxes)&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;scheme/vector&lt;/tt&gt; library provides common vector operations (also reprovided by &lt;tt&gt;scheme&lt;/tt&gt;).&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;scheme/promise&lt;/tt&gt; library provides several new kinds of promises with alternatives execution strategies.&lt;/li&gt;&lt;li&gt;New port-reading utilities: &lt;tt&gt;in-port&lt;/tt&gt;, &lt;tt&gt;port-&amp;gt;list&lt;/tt&gt;, &lt;tt&gt;file-&amp;gt;list&lt;/tt&gt;.&lt;/li&gt;&lt;li&gt;A new require-macro, &lt;tt&gt;path-up&lt;/tt&gt;, for requiring a file that is higher in the directory tree.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-5329605548581881880?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://plt-scheme.org/' title='PLT Scheme v4.2.3'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/5329605548581881880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=5329605548581881880' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/5329605548581881880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/5329605548581881880'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/12/plt-scheme-v423.html' title='PLT Scheme v4.2.3'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-5667444686131365854</id><published>2009-10-04T16:29:00.001-04:00</published><updated>2011-11-09T22:52:20.935-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>PLT Scheme v4.2.2</title><content type='html'>PLT Scheme version 4.2.2 is now available from&lt;pre&gt;  &lt;a href="http://plt-scheme.org/"&gt;&lt;tt&gt;http://plt-scheme.org/&lt;/tt&gt;&lt;/a&gt;&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;DrScheme now, by default, compiles all of the files that are loaded when it runs a program and saves the compiled files in the filesystem.  This should lead to faster load times (not faster runtimes) since it avoids re-compiling files whose dependencies have not changed.&lt;/li&gt;&lt;li&gt;New Scribble libraries and documentation make it easier to get started with Scribble, especially for uses other than PLT documentation.  DrScheme now has better indentation and syntax coloring support for Scribble languages (and generally all @-exp based languages).&lt;/li&gt;&lt;li&gt;The new &lt;tt&gt;syntax/keyword&lt;/tt&gt; library provides support for macros with keyword options.  A new quick start guide has been added to the documentation for the &lt;tt&gt;syntax/parse&lt;/tt&gt; library.&lt;/li&gt;&lt;li&gt;Added support for abstract contracts via the #:exists keywords.  This is an experiment to add support for data hiding to the contract system.&lt;/li&gt;&lt;li&gt;Added &lt;tt&gt;in-producer&lt;/tt&gt;: a sequence expression makes it easy to iterate over producer functions (e.g., &lt;tt&gt;read&lt;/tt&gt;).  A new &lt;tt&gt;scheme/generator&lt;/tt&gt; library creates generators that can use a (parameterized) yield function.&lt;/li&gt;&lt;li&gt;HtDP langs: several primitives now consume 0 and 1 arguments in ISL (and up), including &lt;tt&gt;append&lt;/tt&gt;, &lt;tt&gt;+&lt;/tt&gt; and &lt;tt&gt;*&lt;/tt&gt;.  In addition, &lt;tt&gt;make-list&lt;/tt&gt; was added to the primitives.&lt;/li&gt;&lt;li&gt;The API to Universe has a number of new constructs.  All Universe programs should run unchanged.  The most important change is the addition of &lt;tt&gt;animate&lt;/tt&gt; as an alternative name for &lt;tt&gt;run-simulation&lt;/tt&gt;.  In addition, adding the clause &lt;tt&gt;(state true)&lt;/tt&gt; to a world description now pretty-prints the state of the world into a separate canvas.&lt;/li&gt;&lt;li&gt;A number of changes were made to the DeinProgramm / DMdA language levels: The &lt;tt&gt;check-property&lt;/tt&gt; and &lt;tt&gt;contract&lt;/tt&gt; forms were added, &lt;tt&gt;define-record-procedures-parametric&lt;/tt&gt; has changed.  See the documentation for details.&lt;/li&gt;&lt;li&gt;The test engine in the HtDP languages no longer warns programmers when the Definitions window has no tests.&lt;/li&gt;&lt;li&gt;ProfessorJ (and related code) is no longer included in the PLT distributions.  It may re-appear in the future as a PLaneT package.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-5667444686131365854?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://plt-scheme.org/' title='PLT Scheme v4.2.2'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/5667444686131365854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=5667444686131365854' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/5667444686131365854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/5667444686131365854'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/10/plt-scheme-v422.html' title='PLT Scheme v4.2.2'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-6017258707048735589</id><published>2009-09-21T07:23:00.007-04:00</published><updated>2009-09-21T07:33:08.691-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='set'/><category scheme='http://www.blogger.com/atom/ns#' term='check syntax'/><title type='text'>set! vs set-box! and unbox</title><content type='html'>&lt;p&gt;
A few weeks ago I was chatting with some PLT folks and was surprised to hear them say that they avoided &lt;tt&gt;set!&lt;/tt&gt; because using &lt;tt&gt;set-box!&lt;/tt&gt; and &lt;tt&gt;unbox&lt;/tt&gt; was easier to see what was going on.
&lt;/p&gt;

&lt;p&gt;
This struck me as wrong since one might pass boxes around and then you can't be sure which box you're mutating, but you cannot pass variable references around and thus which variable you're using is always lexically apparent. (Of course, when you add &lt;tt&gt;lambda&lt;/tt&gt; into the mix that isn't really true, since you can capture a variable in a closure and pass that around.)
&lt;/p&gt;

&lt;p&gt;
Their point seemed to be that you had to write something special at each use of the box, unlike with &lt;tt&gt;set!&lt;/tt&gt; where you simply write a variable reference and it might be getting a changing quantity and it might not be. This made me realize I could do something to help, at least, and so I changed Check Syntax so that it colored &lt;tt&gt;set!&lt;/tt&gt;'d variables in red, like this:
&lt;/p&gt;


&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.ece.northwestern.edu/%7Erobby/tmp/cs-set.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: left; cursor: pointer; width: 725px; height: 348px;" src="http://www.ece.northwestern.edu/%7Erobby/tmp/cs-set.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-6017258707048735589?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/6017258707048735589/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=6017258707048735589' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/6017258707048735589'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/6017258707048735589'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/09/set-vs-set-box-and-unbox.html' title='set! vs set-box! and unbox'/><author><name>Robby</name><uri>http://www.blogger.com/profile/08402308775580442837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='13' height='32' src='http://people.cs.uchicago.edu/~robby/portrait-2006.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-3859338948523565949</id><published>2009-07-30T08:24:00.001-04:00</published><updated>2011-11-09T22:52:20.918-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>PLT Scheme v4.2.1</title><content type='html'>PLT Scheme version 4.2.1 is now available from
&lt;pre&gt;  &lt;a href="http://plt-scheme.org/"&gt;&lt;tt&gt;http://plt-scheme.org/&lt;/tt&gt;&lt;/a&gt;&lt;/pre&gt;
&lt;ul&gt;&lt;li&gt;This is the last release that includes ProfessorJ. As of the next release, Kathy Gray who created and maintained the Professor will move the code to planet and maintain only at a minimal level.&lt;/li&gt; &lt;li&gt;Typed Scheme 2.0 extends the type system significantly, making it more expressive.  For example, predicates applied to selectors, such as (number? (car x)), are meaningful to the type system.&lt;/li&gt; &lt;li&gt;Faster installation of Planet packages that trigger install of other Planet packages, because the documentation index is updated only once after a group of packages is installed.&lt;/li&gt; &lt;li&gt;The &lt;tt&gt;syntax/parse&lt;/tt&gt; library provides macro writers with an enhanced syntax pattern matcher that reports errors based on the patterns' declared classes of syntax.&lt;/li&gt; &lt;li&gt;Identifier mappings following the v4 dictionary interface and naming conventions are available from the &lt;tt&gt;syntax/id-table&lt;/tt&gt; library.&lt;/li&gt; &lt;li&gt;Redex: added &lt;tt&gt;define-relation&lt;/tt&gt; and generalized patterns that appear in &amp;quot;where&amp;quot; clauses to use the full Redex pattern matcher. (This is a backwards incompatible change, but one often requested; see the Redex release notes for details.)&lt;/li&gt; &lt;li&gt;The Web Server's serializable closures are now available for other purposes through the web-server/lang/serial-lambda library.&lt;/li&gt; &lt;li&gt;Teachpacks: small changes to universe portion of the &amp;quot;universe.ss&amp;quot; API, plus the addition of a form for launching many (communicating) worlds simultaneously.  Bug fixes concerning conversion to strings.&lt;/li&gt; &lt;li&gt;It is now possible to create custom scribble readers with a command characters different than &lt;tt&gt;@&lt;/tt&gt;, see &lt;tt&gt;make-at-reader/inside&lt;/tt&gt; and &lt;tt&gt;make-at-reader&lt;/tt&gt;&lt;/li&gt; &lt;li&gt;Note: this is likely to be the last release that includes a solaris distribution.  If you need these builds, or if you have access to a (Sparc) Solaris machine than can be used in PLT builds, then please let me know.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-3859338948523565949?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://plt-scheme.org/' title='PLT Scheme v4.2.1'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/3859338948523565949/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=3859338948523565949' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/3859338948523565949'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/3859338948523565949'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/07/plt-scheme-v421.html' title='PLT Scheme v4.2.1'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-6441102098879154048</id><published>2009-06-23T12:02:00.003-04:00</published><updated>2009-06-23T12:39:37.301-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='serialization'/><category scheme='http://www.blogger.com/atom/ns#' term='web-server'/><category scheme='http://www.blogger.com/atom/ns#' term='structure properties'/><category scheme='http://www.blogger.com/atom/ns#' term='macros'/><title type='text'>Serializable Closures in PLT Scheme</title><content type='html'>&lt;p&gt;PLT Scheme supports an extensible &lt;a href="http://docs.plt-scheme.org/reference/serialization.html"&gt;serialization&lt;/a&gt; system for structures. A structure is serializable if it has a &lt;code&gt;prop:serializable&lt;/code&gt; property. There are many &lt;a href="http://docs.plt-scheme.org/search/index.html?q=prop%3A"&gt;properties&lt;/a&gt; in PLT Scheme for other extensions, such as &lt;a href="http://docs.plt-scheme.org/reference/procedures.html#(def._((lib._scheme/base..ss)._prop~3aprocedure))"&gt;applicable structures&lt;/a&gt; and &lt;a href="http://docs.plt-scheme.org/reference/booleans.html#(def._((quote._~23~25kernel)._prop~3aequal+hash))"&gt;custom equality predicates&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://docs.plt-scheme.org/web-server/index.html"&gt;PLT Web&lt;/a&gt; application development framework uses these features to provide &lt;a href="http://docs.plt-scheme.org/web-server/stateless.html#(part._.Serializable_.Continuations)"&gt;serializable continuations&lt;/a&gt; through a number of source transformations and a serializable closure structure.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Warning: This remainder post refers to features only available in the latest SVN revision of PLT Scheme.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I've recently made these closures more accessible to non-Web programs through &lt;code&gt;web-server/lang/serial-lambda&lt;/code&gt;. Here's a demo:&lt;/p&gt;
&lt;pre&gt;
#lang scheme
(require web-server/lang/serial-lambda
         scheme/serialize)

(define f
  (let ([z 5])
    (serial-lambda
     (x y)
     (+ x y z))))

(define (test-it)
  (printf "~S~n" (f 1 2))
  (let ([fs (serialize f)])
    (printf "~S~n" fs)
    (let ([df (deserialize fs)])
      (printf "~S~n" df)
      (printf "~S~n" (df 1 2)))))

&amp;gt; (test-it)
8
((2) 1 ((#"/Users/jay/Dev/svn/plt/collects/web-server/exp/test-serial.ss" . "lifted.6")) 0 () () (0 5))
#(struct:7a410aca70b31e88b4c2f0fe77fa7ffe:0 #&lt;procedure&gt;)
8
&lt;/pre&gt;

&lt;p&gt;Now, let's see how it is implemented. &lt;a href="http://svn.plt-scheme.org/plt/trunk/collects/web-server/lang/serial-lambda.ss"&gt;&lt;code&gt;web-server/lang/serial-lambda&lt;/code&gt;&lt;/a&gt; is thin wrapper around &lt;a href="http://svn.plt-scheme.org/plt/trunk/collects/web-server/lang/closure.ss"&gt;&lt;code&gt;web-server/lang/closure&lt;/code&gt;&lt;/a&gt;, which has two syntax transformer functions: &lt;code&gt;define-closure!&lt;/code&gt; which defines the closure structure and &lt;code&gt;make-closure&lt;/code&gt; which instantiates the closure. (The two tasks are separated to easily provide a user top-level definition syntax for named closures with different free identifires, rather than simply anonymous lambdas with fixed free identifiers.)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;make-closure&lt;/code&gt; does the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Expands the procedure syntax using &lt;a href="http://docs.plt-scheme.org/reference/stxtrans.html#(def._((quote._~23~25kernel)._local-expand))"&gt;&lt;code&gt;local-expand&lt;/code&gt;&lt;/a&gt;, so it can use &lt;a href="http://docs.plt-scheme.org/syntax/syntax-helpers.html#(def._((lib._syntax/free-vars..ss)._free-vars))"&gt;&lt;code&gt;free-vars&lt;/code&gt;&lt;/a&gt; to compute the free identifires.&lt;/li&gt;
&lt;li&gt;Uses &lt;code&gt;define-closure!&lt;/code&gt; to define the structure and get the name for the constructor.&lt;/li&gt;
&lt;li&gt;Instantiates the closure with the current values of the free identifiers.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The more interesting work is done by &lt;code&gt;define-closure!&lt;/code&gt;. At a high-level, it needs to do the following:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a deserialization function.&lt;/li&gt;
&lt;li&gt;Create a serialization function that references the deserializer.&lt;/li&gt;
&lt;li&gt;Define the closure structure type that references the serializer.&lt;/li&gt;
&lt;li&gt;Provide the deserializer from the current module so that arbitrary code can deserialize instances of this closure type.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These tasks are complicated in a few ways:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The deserializer needs the closure structure type definition to create instances and the serializer needs the closure structure type to access their fields.&lt;/li&gt;
&lt;li&gt;The serializer needs the syntactic identifier of the deserializer so that &lt;code&gt;scheme/serialize&lt;/code&gt; can &lt;a href="http://docs.plt-scheme.org/reference/Module_Names_and_Loading.html#(def._((quote._~23~25kernel)._dynamic-require))"&gt;&lt;code&gt;dynamic-require&lt;/code&gt;&lt;/a&gt; it during deserialization.&lt;/li&gt;
&lt;li&gt;The deserializer must be defined at the top-level, so it may be provided.&lt;/li&gt;
&lt;li&gt;All this may occur in a syntactic expression context.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thankfully, the PLT Scheme &lt;a href="http://docs.plt-scheme.org/reference/Macros.html"&gt;macro system&lt;/a&gt; is powerful to support all this.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://docs.plt-scheme.org/reference/stxtrans.html#(def._((quote._~23~25kernel)._syntax-local-lift-expression))"&gt;&lt;code&gt;syntax-local-lift-expression&lt;/code&gt;&lt;/a&gt; allows a syntax transformer to lift an expression to the top-level of a module and returns the identifier it is bound to.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://docs.plt-scheme.org/search/index.html?q=syntax-local-lift-values-expression"&gt;&lt;code&gt;syntax-local-lift-values-expression&lt;/code&gt;&lt;/a&gt; (added in 4.2.0.3) provides the same for expressions that return multiple values, such as &lt;a href="http://docs.plt-scheme.org/reference/creatingmorestructs.html#(def._((quote._~23~25kernel)._make-struct-type))"&gt;&lt;code&gt;make-struct-type&lt;/code&gt;&lt;/a&gt;, which is used to define structures.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://docs.plt-scheme.org/search/index.html?q=syntax-local-lift-provide"&gt;&lt;code&gt;syntax-local-lift-provide&lt;/code&gt;&lt;/a&gt; (added in 4.2.0.4) allows a syntax transformer to lift a provide to the top-level.&lt;/li&gt;
 &lt;/ul&gt;

&lt;p&gt;The only complicated piece is allowing the deserializer and serializer to refer to the closure structure constructor and accessors. This is easily accomplished by first defining lifting boxes that will hold these values and initializing them when the structure type is defined. This is safe because all accesses to the boxes are under lambdas that are guaranteed not to be run before the structure type is defined.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An aside on the closure representation.&lt;/strong&gt; The closure is represented as a structure with one field: the environment. The environment is represented as a thunk that returns &lt;em&gt;n&lt;/em&gt; values, one for each of the free identifiers. This ensures that references that were under lambdas in the original syntax, remain under lambdas in the closure construction, so the serializable closures work correctly inside &lt;code&gt;letrec&lt;/code&gt;. This thunk is applied by the serializer and the free values are stored in a vector. The closure also uses the &lt;code&gt;prop:procedure&lt;/code&gt; structure property to provide an application function that simply invokes the environment thunk and binds its names, then &lt;code&gt;apply&lt;/code&gt;s the original procedure syntax to the arguments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An aside on the serializer.&lt;/strong&gt; The deserializer is bound to lifted identifier which is represented in PLT Scheme as an unreadable symbol. Version 4.2.0.5 added support for (de)serializing these.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-6441102098879154048?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/6441102098879154048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=6441102098879154048' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/6441102098879154048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/6441102098879154048'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/06/serializable-closures-in-plt-scheme.html' title='Serializable Closures in PLT Scheme'/><author><name>Jay McCarthy</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-13KUDv8LhZw/AAAAAAAAAAI/AAAAAAAAAAA/7MdiB5POU5k/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-655377273386641529</id><published>2009-06-01T14:41:00.001-04:00</published><updated>2011-11-09T22:52:20.947-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>PLT Scheme v4.2</title><content type='html'>PLT Scheme version 4.2 is now available from&lt;pre&gt;  &lt;a href="http://plt-scheme.org/"&gt;http://plt-scheme.org/&lt;/a&gt;&lt;/pre&gt;
Internally, this version includes a conversion from C++ to Scheme for part of the GUI toolbox --- specifically, 25k lines of code that implement the general text and pasteboard editor.  This conversion is a start on a larger reimplementation of the GUI toolbox.  Although we believe that this change will help make PLT Scheme better in the long run, we must expect bugs in the short term due to porting errors.  Users should therefore be aware of the change, even though the new implementation is meant to behave the same as previous versions.
&lt;ul&gt;
&lt;li&gt;A new statistical profiler is now available; see the "profiler" manual for more information.  Currently, the profiler supports only textual output, but future plans include a GUI interface and DrScheme integration.&lt;/li&gt;
&lt;li&gt;The &lt;tt&gt;world&lt;/tt&gt; teachpack is now deprecated.  Its replacement &lt;tt&gt;universe&lt;/tt&gt; has a new interface that uses strings instead of symbols and characters.&lt;/li&gt;
&lt;li&gt;Web-server: Native continuations in the stateless servlet language support capturing continuations from untransformed contexts; soft state library for stateless servlets.&lt;/li&gt;
&lt;li&gt;DrScheme's Stepper can now jump to a selected program expression.&lt;/li&gt;
&lt;li&gt;New in &lt;tt&gt;scheme/base&lt;/tt&gt;: &lt;tt&gt;hash-has-key?&lt;/tt&gt;, &lt;tt&gt;hash-ref!&lt;/tt&gt;, &lt;tt&gt;in-sequences&lt;/tt&gt;, &lt;tt&gt;in-cycle&lt;/tt&gt;.  New in &lt;tt&gt;scheme&lt;/tt&gt;: &lt;tt&gt;count&lt;/tt&gt;, &lt;tt&gt;make-list&lt;/tt&gt; (from &lt;tt&gt;scheme/list&lt;/tt&gt;), &lt;tt&gt;const&lt;/tt&gt; (from &lt;tt&gt;scheme/function&lt;/tt&gt;).&lt;/li&gt;
&lt;li&gt;Some performance improvements, including faster start-up for small programs. The latter is a result of delaying module invocations at higher phases (compile time, meta-compile time, etc.) until compilation is demanded at the next lower phase; this on-demand instantiation is per-phase, as opposed to per-module within a phase.&lt;/li&gt;
&lt;/ul&gt;

[Note that mirror sites can take a while to catch up with the new downloads.]

Feedback Welcome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-655377273386641529?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://plt-scheme.org/' title='PLT Scheme v4.2'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/655377273386641529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=655377273386641529' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/655377273386641529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/655377273386641529'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/06/plt-scheme-v42.html' title='PLT Scheme v4.2'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-4636049989832884950</id><published>2009-05-25T13:47:00.003-04:00</published><updated>2009-05-25T13:53:43.299-04:00</updated><title type='text'>Typed Scheme 2.0</title><content type='html'>&lt;p&gt;Typed Scheme version 2.0 is now available from SVN.&lt;/p&gt;

&lt;p&gt;One persistent limitation of Typed Scheme has been that while this expression works as expected:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;(if (number? x) (add1 x) 7)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The simple transformation of making &lt;code&gt;x&lt;/code&gt; a part of a structure breaks Typed Scheme's ability to reason about the code. So this expression doesn't typecheck:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;(if (number? (car x)) (add1 (car x)) 7)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;With the newest version of Typed Scheme, now available in SVN, both of these will now work.  In general, Typed Scheme can now follow paths into arbitrary immutable structures, including pairs.&lt;/p&gt;

&lt;p&gt;This is part of a more general reworking of underlying mechanisms of the Typed Scheme typechecker, which makes it both simpler and more flexible.  I hope that it will be possible,  sing this new foundation to add additional features that make more programs easy to express in
Typed Scheme.&lt;/p&gt;

&lt;p&gt;Of course, these changes mean that Typed Scheme may be more unstable, so if you notice any new bugs, please let us know.&lt;/p&gt;

&lt;p&gt;Unfortunately, this won't be available in the upcoming 4.2 release, but it will be in the release after that.&lt;/p&gt;

&lt;p&gt;If you have any questions or comments or feature requests for Typed Scheme, please let us know.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-4636049989832884950?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/4636049989832884950/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=4636049989832884950' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/4636049989832884950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/4636049989832884950'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/05/typed-scheme-20.html' title='Typed Scheme 2.0'/><author><name>Sam Tobin-Hochstadt</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-1513383412261723218</id><published>2009-05-24T03:17:00.004-04:00</published><updated>2009-05-24T06:32:04.858-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='macros'/><title type='text'>Explicit Renaming Macros; Implicitly</title><content type='html'>It's been one too many times that I hear respectable Schemers talk about how they like explicit renaming macros &amp;#8212; not because they're more powerful, but because using them is close to using simple &lt;tt&gt;defmacro&lt;/tt&gt;s.  In this post I'll show how you can easily write ER-like macros in PLT, just so I won't need to explain the same thing once again.

Disclaimers:&lt;ul&gt;&lt;li&gt;If you're not interested in ER-macros, then you shouldn't read this.&lt;/li&gt;&lt;li&gt;I'm not claiming that ER macros are not respectable, I'm just surprised at the knee jerk reaction to &lt;tt&gt;syntax-case&lt;/tt&gt;.&lt;/li&gt;&lt;li&gt;This is not an attempt at providing some portable library or even a PLT library. The intention is to show that &lt;tt&gt;syntax-case&lt;/tt&gt;-style macros are "as convenient" as ER macros, if you really want to get down to that level.&lt;/li&gt;&lt;li&gt;This is also not an attempt at any kind of formal claim of equivalence in any direction, only a demonstration that you can get the same kind of convenience.&lt;/li&gt;&lt;li&gt;The bottom line here should be just the convenience point, addressed at people who like ER macros for that, and who think that &lt;tt&gt;syntax-case&lt;/tt&gt; macros are somehow magical or that you lose the ability to play with S-expressions.&lt;/li&gt;&lt;/ul&gt;

The important fact here is that while PLT's &lt;tt&gt;syntax-case&lt;/tt&gt; macro system does not give you raw S-expressions, what you get is a simple wrapper holding them.  A macro is a syntax transformer: a function that consumes a syntax value and returns one.  For example:&lt;pre&gt;  (define-syntax (foo stx)
    #'123)&lt;/pre&gt;is a macro that always expands to 123 (with &lt;tt&gt;#'123&lt;/tt&gt; being the usual shorthand for &lt;tt&gt;(syntax 123)&lt;/tt&gt;).

A syntax object in PLT Scheme (the input to macro functions) is an S-expression, with some lexical information added &amp;#8212; this includes the lexical context (in an opaque form), source location, and a few more things.  To be more precise, a syntax value is a nested structure of wrappers holding lists and pairs, holding more wrappers, with identifiers at the leaves, where an identifier is a wrapper holding a symbol.  It's easy to strip off all wrappers using &lt;tt&gt;syntax-&amp;gt;datum&lt;/tt&gt; if you like to work with S-expressions, but you &lt;em&gt;don't&lt;/em&gt; want to strip it off of identifiers, since that will lose the important gravy.  (In fact, the &lt;tt&gt;defmacro&lt;/tt&gt; library works by stripping off all information, even from identifiers, then reconstructing it by trying to match names in the output form with the original input.)

Instead of throwing away all information, what we want to do is preserve identifiers.  We can use &lt;tt&gt;syntax-&amp;gt;list&lt;/tt&gt; for this: this is a function that takes a syntax value that contains a list, and strips off the top-level extra information leaving you with a list of syntaxes for the sub-expressions (returning &lt;tt&gt;#f&lt;/tt&gt; if the input syntax does not hold a list).  Once we have such a list, we can do the usual kind of processing with it, and when we're done turn the result back into a syntax using &lt;tt&gt;datum-&amp;gt;syntax&lt;/tt&gt; (which "borrows" the original input expression's information).  For example,&lt;pre&gt;  (define-syntax (add1 stx)
    (let ([+ #'+])
      (datum-&amp;gt;syntax stx `(,+ 1 ,@(cdr (syntax-&amp;gt;list stx))) stx)))&lt;/pre&gt;That's a very simple example though; if you try something a little more complicated, you quickly find out that all this unwrapping is inconvenient:&lt;pre&gt;  (define-syntax (mylet stx)
    (let ([*lambda #'lambda])
      (datum-&amp;gt;syntax
       stx
       `((,*lambda ,(map (lambda (x) (car (syntax-&amp;gt;list x)))
                         (syntax-&amp;gt;list (cadr (syntax-&amp;gt;list stx))))
                   ,@(cddr (syntax-&amp;gt;list stx)))
         ,@(map (lambda (x) (cadr (syntax-&amp;gt;list x)))
                (syntax-&amp;gt;list (cadr (syntax-&amp;gt;list stx)))))
       stx)))&lt;/pre&gt;(Note also the &lt;tt&gt;*lambda&lt;/tt&gt; that is used to avoid the &lt;tt&gt;lambda&lt;/tt&gt; expressions used in the meta-code.)

What can help here is some helper function that receive a syntax value as its input, and turn all wrapped lists into real lists recursively, but will leave identifiers intact:&lt;pre&gt;  (begin-for-syntax
    (define (strip stx)
      (let ([maybe-list (syntax-&amp;gt;list stx)])
        ;; syntax-&amp;gt;list returns #f if the syntax is not a list
        (if maybe-list (map strip maybe-list) stx))))&lt;/pre&gt;But as long as we're writing a syntax utility, we can make it do a litte more work: feed the resulting tree to &lt;em&gt;your&lt;/em&gt; transformer, grab its result, and do the necessary &lt;tt&gt;datum-&amp;gt;syntax&lt;/tt&gt; voodoo on it:&lt;pre&gt;  (begin-for-syntax
    (define (er-like-transformer transformer)
      (define (strip stx)
        (let ([maybe-list (syntax-&amp;gt;list stx)])
          ;; syntax-&amp;gt;list returns #f if the syntax is not a list
          (if maybe-list (map strip maybe-list) stx)))
      (lambda (stx)
        (datum-&amp;gt;syntax stx (transformer (strip stx)) stx))))&lt;/pre&gt;

With this utility defined, the above macro becomes much easier to deal with:&lt;pre&gt;  (define-syntax mylet
    (er-like-transformer
     (lambda (exp)
       (let ((vars  (map car (cadr exp)))
             (inits (map cadr (cadr exp)))
             (body  (cddr exp)))
         `((,(syntax lambda) ,vars ,@body)
           ,@inits)))))&lt;/pre&gt;...and this is almost identical to the explicit renaming version of the macro; for example, compare it with the sample code in the &lt;a href="http://groups.csail.mit.edu/mac/projects/scheme/documentation/scheme_3.html#SEC49"&gt;MIT-Scheme manual&lt;/a&gt;.  The only change is that &lt;tt&gt;(rename 'lambda)&lt;/tt&gt; is replaced with &lt;tt&gt;(syntax lambda)&lt;/tt&gt;.

Obviously, this is very close, but doesn't show intentional captures.  So I just grabbed the &lt;tt&gt;loop&lt;/tt&gt; example from the same page, and did the same change &amp;#8212; only this time I used &lt;tt&gt;#'foo&lt;/tt&gt; instead of &lt;tt&gt;(syntax foo)&lt;/tt&gt; (and I also changed the one-sided &lt;tt&gt;if&lt;/tt&gt; to a &lt;tt&gt;when&lt;/tt&gt;).  The resulting macro works fine:&lt;pre&gt;  (define-syntax loop
    (er-like-transformer
     (lambda (x)
       (let ((body (cdr x)))
         `(,#'call-with-current-continuation
           (,#'lambda (exit)
            (,#'let ,#'f () ,@body (,#'f))))))))
  
  (define-syntax while
    (syntax-rules ()
      ((while test body ...)
       (loop (when (not test) (exit #f))
             body ...))))
  
  (let ((x 10))
    (while (&amp;gt; x 0)
      (printf "~s\n" x)
      (set! x (- x 1))))&lt;/pre&gt;

This is pretty close to a library, and indeed, as I was writing this text I found &lt;a href="http://www.mail-archive.com/larceny-users@lists.ccs.neu.edu/msg00097.html"&gt;a post by Andre van Tonder&lt;/a&gt; on the Larceny mailing list that uses a very similar approach and &lt;em&gt;does&lt;/em&gt; make a library out of it.  This is done by adding two arguments to the expected ER-transformation function &amp;#8212; one is a &lt;tt&gt;rename&lt;/tt&gt; function (since the above method uses &lt;tt&gt;syntax&lt;/tt&gt; it is limited to immediate identifiers), and the other is always passed as &lt;tt&gt;free-identifier=?&lt;/tt&gt;.  Such a compatibility library is, however, not the purpose of this post.

Finally, there is still a minor issue with this &amp;#8212; PLT has an implicit &lt;tt&gt;#%app&lt;/tt&gt; which is used wherever there are parentheses that stand for a function application &amp;#8212; and in this code they are used unhygienically.  This is usually not a noticeable problem, and if it is, you can add explicit &lt;tt&gt;#%app&lt;/tt&gt;s.  It might also be possible to find a more proper solution (e.g., use a hash table to keep track of lists that were disassembled by the client transformer), but at this point it might be better to just use the more natural &lt;tt&gt;syntax-case&lt;/tt&gt; anyway.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-1513383412261723218?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/1513383412261723218/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=1513383412261723218' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1513383412261723218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1513383412261723218'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/05/explicit-renaming-macros-implicitly.html' title='Explicit Renaming Macros; Implicitly'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-6629705111318307010</id><published>2009-05-18T16:48:00.000-04:00</published><updated>2009-05-18T16:50:22.523-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='delimited continuations'/><category scheme='http://www.blogger.com/atom/ns#' term='serialization'/><category scheme='http://www.blogger.com/atom/ns#' term='web-server'/><category scheme='http://www.blogger.com/atom/ns#' term='continuations'/><category scheme='http://www.blogger.com/atom/ns#' term='macros'/><title type='text'>The Two State Solution: Native and Serializable Continuations in the PLT Web Server</title><content type='html'>&lt;p&gt;One of the annoyance of the &lt;a href="http://docs.plt-scheme.org/web-server/stateless.html"&gt;stateless Web application&lt;/a&gt; language that comes with the PLT Web Server is that you can't call &lt;em&gt;third-party higher-order library procedures with arguments that try to capture serializable continuations&lt;/em&gt;. (I know, you try to do that all the time.) For example:&lt;/p&gt;

&lt;pre&gt;
(build-list
 3
 (lambda (i)
   (call-with-serializable-current-continuation
    (lambda (k) (serialize k)))))
&lt;/pre&gt;

&lt;p&gt;The problem is that the stateless language performs a transformation on your program to extract the continuations into a serializable representation. If you really need to do this, we've developed a compromise called "The Two State Solution": one state on the client and the other on the server. Only the third-party parts of the continuation (in this case, the code inside &lt;code&gt;build-list&lt;/code&gt;) are stored on the server; everything else is shipped to the client. You just need to annotate your code slightly to indicate where the transition is:&lt;/p&gt;

&lt;pre&gt;
(serial-&gt;native
 (build-list
  3
  (lambda (i)
    (native-&gt;serial
     (call-with-serializable-current-continuation
      (lambda (k) (serialize k)))))))
&lt;/pre&gt;

&lt;p&gt;&lt;code&gt;serial-&gt;native&lt;/code&gt; signals the transition to the third-party and &lt;code&gt;native-&gt;serial&lt;/code&gt; signals the transition back.&lt;/p&gt;

&lt;p&gt;It is still a little annoying to find when you've called these &lt;em&gt;third-party higher-order library procedures with arguments that try to capture serializable continuations&lt;/em&gt;, so there's a simple macro that provides a transitioning wrapper for you:&lt;/p&gt;

&lt;pre&gt;(define-native (build-list/native _ ho) build-list)&lt;/pre&gt;

&lt;p&gt;expands to:&lt;/p&gt;

&lt;pre&gt;
(define (build-list/native fst snd)
  (serial-&gt;native
   (build-list
    fst
    (lambda args
      (native-&gt;serial
       (apply snd args))))))
&lt;/pre&gt;

&lt;p&gt;This new feature is documented in the &lt;a href="http://faculty.cs.byu.edu/~jay/plt-doc/web-server/stateless.html#(part._.Serializable_.Continuations)"&gt;online manual&lt;/a&gt;, of course.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-6629705111318307010?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/6629705111318307010/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=6629705111318307010' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/6629705111318307010'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/6629705111318307010'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/05/two-state-solution-native-and.html' title='The Two State Solution: Native and Serializable Continuations in the PLT Web Server'/><author><name>Jay McCarthy</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-13KUDv8LhZw/AAAAAAAAAAI/AAAAAAAAAAA/7MdiB5POU5k/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-4752160555167530543</id><published>2009-05-18T16:47:00.000-04:00</published><updated>2009-05-18T16:48:23.767-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='web-server'/><category scheme='http://www.blogger.com/atom/ns#' term='soft state'/><title type='text'>Soft State in the PLT Web Server</title><content type='html'>&lt;p&gt;Many Web applications and network protocols have values in the continuation that are necessary to complete the computation, but that may be recomputed if they are not available. This is "soft state".&lt;/p&gt;

&lt;p&gt;For example, a Web application may cache a user's preferences from a database and deliver it to a Web browser as a hidden value; when the value is returned to the application in subsequent steps, it is used to customize the display. However, if the preferences were not available (or were corrupted in some way), the application could retrieve them from the database.&lt;/p&gt;

&lt;p&gt;When using the PLT Web Server's native continuations, this roughly corresponds to the use of a &lt;em&gt;weak box&lt;/em&gt;: a box that the GC is allowed to erase the contents of. When using the PLT Web Server's serializable continuations it roughly corresponds to a weak box and a &lt;em&gt;weak hash table&lt;/em&gt; (that holds its keys weakly) to give the box a serializable value as an identifier.&lt;/p&gt;

&lt;p&gt;This programming pattern is a bit difficult to get right. So, a library that implements it is now provided with PLT Scheme: &lt;a href="http://faculty.cs.byu.edu/~jay/plt-doc/web-server/stateless.html#(part._.Soft_.State)"&gt;&lt;code&gt;web-server/lang/soft&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here's a trivial example:&lt;/p&gt;
&lt;pre&gt;
#lang web-server

(provide interface-version start)
(define interface-version 'stateless)

(define softie
  (soft-state
   (printf "Doing a long computation...~n")
   (sleep 1)))

(define (start req)
  (soft-state-ref softie)
  (printf "Done~n")
  (start
   (send/suspend
    (lambda (k-url)
      `(html (body (a ([href ,k-url]) "Done")))))))
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-4752160555167530543?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/4752160555167530543/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=4752160555167530543' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/4752160555167530543'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/4752160555167530543'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/05/soft-state-in-plt-web-server.html' title='Soft State in the PLT Web Server'/><author><name>Jay McCarthy</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-13KUDv8LhZw/AAAAAAAAAAI/AAAAAAAAAAA/7MdiB5POU5k/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-1921164854547299677</id><published>2009-05-18T13:10:00.002-04:00</published><updated>2009-05-18T13:14:54.154-04:00</updated><title type='text'>Scheme Workshop: deadline NOT extended!</title><content type='html'>&lt;p&gt;We're holding the line on our submission deadline; it's still June 5, so that gives you about three weeks to write something awesome.&lt;/p&gt;

&lt;p&gt;Re-posting the entire CfP on a blog seems a bit tacky, so instead I'll just post the link:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blog.plt-scheme.org/2009/01/cfp-scheme-workshop-2009.html"&gt;
http://blog.plt-scheme.org/2009/01/cfp-scheme-workshop-2009.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We look forward to your submissions!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-1921164854547299677?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://blog.plt-scheme.org/2009/01/cfp-scheme-workshop-2009.html' title='Scheme Workshop: deadline NOT extended!'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/1921164854547299677/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=1921164854547299677' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1921164854547299677'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1921164854547299677'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/05/scheme-workshop-deadline-not-extended.html' title='Scheme Workshop: deadline NOT extended!'/><author><name>John Clements</name><uri>http://www.blogger.com/profile/10401643794201938443</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-2334413198277409498</id><published>2009-05-06T08:58:00.001-04:00</published><updated>2009-05-06T09:00:14.107-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='channels'/><category scheme='http://www.blogger.com/atom/ns#' term='threads'/><category scheme='http://www.blogger.com/atom/ns#' term='web-server'/><category scheme='http://www.blogger.com/atom/ns#' term='continuations'/><title type='text'>What is send/suspend?</title><content type='html'>&lt;p&gt;I often ponder what &lt;a href="http://docs.plt-scheme.org/web-server/servlet.html#(def._((lib._web-server/servlet/web..ss)._send/suspend))"&gt;&lt;code&gt;send/suspend&lt;/code&gt;&lt;/a&gt; really is. It is a lot like &lt;code&gt;call/cc&lt;/code&gt;, but has the curious property that the continuation escapes in a single way and is only called in a particular context. I often wonder if there is something weaker than &lt;code&gt;call/cc&lt;/code&gt; that implements &lt;code&gt;send/suspend&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Today I wrote a little dispatcher that uses threads to implement &lt;code&gt;send/suspend&lt;/code&gt;. In this implementation, &lt;em&gt;send&lt;/em&gt;ing truly &lt;em&gt;suspend&lt;/em&gt;s the computation.&lt;/p&gt;

&lt;p&gt;Here's the code: &lt;a href="http://www.copypastecode.com/codes/view/5003"&gt;http://www.copypastecode.com/codes/view/5003&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The trick is to have channels for communicating responses and requests. When you run this example, you should be able to add two numbers. But, in contrast to the normal &lt;code&gt;send/suspend&lt;/code&gt;, all the URLs are one-shots, because once the computation is resumed, it moves forward... it is never saved.&lt;/p&gt;

&lt;p&gt;This implementation technique also precludes clever implementations of &lt;code&gt;send/suspend/dispatch&lt;/code&gt;, like:&lt;/p&gt;
&lt;pre&gt;
(define (send/suspend/dispatch mk-page)
  (let/cc k0
    (send/back
     (mk-page
      (lambda (handler)
        (let/ec k1 
          (k0 (handler (send/suspend k1)))))))))
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-2334413198277409498?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/2334413198277409498/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=2334413198277409498' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2334413198277409498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2334413198277409498'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/05/what-is-sendsuspend.html' title='What is send/suspend?'/><author><name>Jay McCarthy</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-13KUDv8LhZw/AAAAAAAAAAI/AAAAAAAAAAA/7MdiB5POU5k/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-8595329905636585805</id><published>2009-03-29T13:03:00.004-04:00</published><updated>2009-03-29T20:17:34.367-04:00</updated><title type='text'>the DrScheme repl isn't the one in Emacs</title><content type='html'>Dear old Lisper,

&lt;div&gt;&lt;p&gt;You have found drscheme and it is almost like your old Lisp machine.
It is easy to program in it, it has things that nobody else has, and
we all love parentheses. But after some initial enthusiasm you
are wondering why in the world, we decided not to provide
commands for sending individual definitions and expressions
from the Definitions window to the Interactions window, aka,
REPL.&lt;/p&gt;

&lt;div&gt;&lt;p&gt;It wasn't an accident. It was by design after some difficult
experiences. I am personally a product of the Emacs world that you are describing below,
and my advisor Dan Friedman was called the "Lispman" on his door
sign at Indiana.&lt;/p&gt;

&lt;p&gt;When I first discovered the idea of sending individual expressions
and definitions from a buffer to a repl, it was a near-religious
revelation to me. I wanted everyone to know this trick and use it.
When I started teaching the freshman course at Rice, I told our
chairman so and he asked "why". I was shocked, awed, and I failed
to explain to him how it mattered. He was a mathematician and I
wrote it off. They don't know.&lt;/p&gt;

&lt;p&gt;Then I started watching my sophomores and juniors at Rice in lab.
Now that was a true disappointment. Few if any used this trick and
when they did, they more often tripped up and got the repl into a
state where they didn't know what was going on.&lt;/p&gt;

&lt;p&gt;In the mid 90s, I wrote some more Little books with Dan, and boy,
time and again, I watched him stumble across the state of the repl.
I even watched him re-start the repl and load the whole buffer more
often than not.&lt;/p&gt;

&lt;p&gt;Why? In the presence of macros and higher-order functions and
other beasts, it is difficult for masters of the universe with 30
years of experience to keep track of things. What do you think
students with 10 or 20 days worth of experience will do? Is it
really such a deep principle of computing to create the objects
incrementally in the repl as opposed to thinking systematically
through the design of a program?&lt;/p&gt;

&lt;p&gt;I decided not and asked Robby to make DrScheme's repl transparent.
That is, it re-starts the repl and re-loads the buffer every time.
I consider this behavior a suitable compromise: have a repl but
don't confuse yourself with send-defs and send-exprs. This is
especially true in an age when sending an entire buffer takes as
much time as sending an individual expression or definition.
Soon we'll get "compilation behind your back" so that only the
current buffer is re-interpreted. It'll start things even faster.&lt;/p&gt;

&lt;p&gt;Even though I had used the incremental mode for more than a decade
when I switched from Emacs to DrScheme in 1998, I have hardly ever
looked back. I miss a few other things but the incremental repl
is one of those rituals old Lispers acquired and never questioned
... but it isn't fundamental and critical to anything. (Note
there is no qualifying clauses, no when no if no but. I really mean
this last sentence the way I spelled it.)&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-8595329905636585805?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/8595329905636585805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=8595329905636585805' title='30 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8595329905636585805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8595329905636585805'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/03/drscheme-repl-isnt-lisp.html' title='the DrScheme repl isn&apos;t the one in Emacs'/><author><name>matthias</name><uri>http://www.blogger.com/profile/00000181081270224360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://www.ccs.neu.edu/home/matthias/Images/felleisen1.jpg'/></author><thr:total>30</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-109123988427683012</id><published>2009-03-22T01:29:00.001-04:00</published><updated>2011-11-09T22:52:20.886-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>PLT Scheme v4.1.5</title><content type='html'>PLT Scheme version 4.1.5 is now available from
&lt;pre&gt;  &lt;a href="http://plt-scheme.org/"&gt;http://plt-scheme.org/&lt;/a&gt;&lt;/pre&gt;
&lt;ul&gt;&lt;li&gt;Web Server:&lt;ul&gt;&lt;li&gt;new URL-based dispatching library &lt;tt&gt;web-server/dispatch&lt;/tt&gt;,&lt;/li&gt;&lt;li&gt;customizable continuation serialization policies for the stateless web language &lt;tt&gt;web-server/stuffers&lt;/tt&gt;,&lt;/li&gt;&lt;li&gt;abstraction of serve/servlet to build simpler dispatchers &lt;tt&gt;web-server/servlet-env&lt;/tt&gt;,&lt;/li&gt;&lt;li&gt;HTTP Digest authentication support &lt;tt&gt;web-server/http/digest-auth&lt;/tt&gt;,&lt;/li&gt;&lt;li&gt;built-in cookie support in &lt;tt&gt;web-server/http/cookie&lt;/tt&gt; and &lt;tt&gt;web-server/http/cookie-parse&lt;/tt&gt;,&lt;/li&gt;&lt;li&gt;highlighting and pretty-printing of errors in Xexpr constructions,&lt;/li&gt;&lt;li&gt;load control dispatcher for limit concurrent sessions &lt;tt&gt;web-server/dispatchers/limit&lt;/tt&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Scribble:&lt;ul&gt;&lt;li&gt;Literate programming is now available using the new &lt;tt&gt;scribble/lp&lt;/tt&gt; language.&lt;/li&gt;&lt;li&gt;A new &lt;tt&gt;at-exp&lt;/tt&gt; language makes it convenient to use the scribble reader's @-expressions for general code.&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;scribble/text&lt;/tt&gt; preprocessor language has been extended to deal with indentation and other formatting issues.&lt;/li&gt;&lt;li&gt;The "scribble" command-line tool accepts a &lt;tt&gt;--pdf&lt;/tt&gt; flag to render PDFs (via pdflatex).&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;DrScheme now provides feedback when PLaneT downloads and installs new packages.&lt;/li&gt;
&lt;li&gt;Units &amp; Contracts:&lt;ul&gt;&lt;li&gt;Elements of unit signatures can now be associated with contracts via the &lt;tt&gt;contracted&lt;/tt&gt; signature form.&lt;/li&gt;&lt;li&gt;A contract combinator for units, &lt;tt&gt;unit/c&lt;/tt&gt;, has been added.&lt;/li&gt;&lt;li&gt;The new &lt;tt&gt;with-contract&lt;/tt&gt; form provides a nestable submodule contract boundary, protecting a group of definitions from the surrounding code with contracts.&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;define/contract&lt;/tt&gt; form has been reworked and new define forms have been added: &lt;tt&gt;define-struct/contract&lt;/tt&gt; and &lt;tt&gt;define-unit/contract&lt;/tt&gt;.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Language levels and teachpacks from the DeinProgramm project for the German textbook "Die Macht der Abstraktion" by Herbert Klaeren and Michael Sperber have been added.&lt;/li&gt;
&lt;li&gt;Misc:&lt;ul&gt;&lt;li&gt;Typed Scheme now comes with several more pre-wrapped libraries, found in the &lt;tt&gt;typed&lt;/tt&gt; collection.&lt;/li&gt;&lt;li&gt;The &lt;tt&gt;xml&lt;/tt&gt; and &lt;tt&gt;html&lt;/tt&gt; collections are now contracted.&lt;/li&gt;&lt;li&gt;Binding parsing in net/cgi now interacts with &lt;tt&gt;net/uri-codec&lt;/tt&gt;'s configuration parameters.&lt;/li&gt;&lt;li&gt;DrScheme captures logging output.&lt;/li&gt;&lt;li&gt;Check syntax: it is now possible to tack arrows crossing the currently selected text.&lt;/li&gt;&lt;li&gt;New &lt;tt&gt;bitwise-bit-field&lt;/tt&gt; function.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;The usual pile of bugfixes.  (Notable: &lt;tt&gt;scheme/package&lt;/tt&gt; works, &lt;tt&gt;deflate&lt;/tt&gt; compression fixed, DrScheme language dialog issue resolved, &lt;tt&gt;match&lt;/tt&gt; fixes, Windows networking, and much more.)&lt;/li&gt;
&lt;/ul&gt;

[Note that mirror sites can take a while to catch up with the new downloads.]

Feedback Welcome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-109123988427683012?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://plt-scheme.org/' title='PLT Scheme v4.1.5'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/109123988427683012/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=109123988427683012' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/109123988427683012'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/109123988427683012'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/03/plt-scheme-v415.html' title='PLT Scheme v4.1.5'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-7043792165582137178</id><published>2009-03-12T16:35:00.030-04:00</published><updated>2009-03-13T17:22:06.108-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='planet'/><category scheme='http://www.blogger.com/atom/ns#' term='scribble'/><category scheme='http://www.blogger.com/atom/ns#' term='self-reference'/><category scheme='http://www.blogger.com/atom/ns#' term='documentation'/><title type='text'>Maintaining self-references in Planet packages</title><content type='html'>&lt;p&gt;
&lt;a href="http://docs.plt-scheme.org/planet/index.html"&gt;PLaneT packages&lt;/a&gt; may refer to themselves (i.e. include &lt;a href="http://docs.plt-scheme.org/guide/module-paths.html"&gt;module paths&lt;/a&gt; referring to some part of the same package) for a number of reasons. One module may &lt;a href="http://docs.plt-scheme.org/reference/require.html#%28form._%28%28lib._scheme/base..ss%29._require%29%29"&gt;&lt;span style="font-family:courier new;"&gt;require&lt;/span&gt;&lt;/a&gt; another. &lt;a href="http://docs.plt-scheme.org/scribble/index.html"&gt;Scribble&lt;/a&gt; documentation traces &lt;a href="http://docs.plt-scheme.org/reference/require.html#%28form._%28%28lib._scheme/base..ss%29._for-label%29%29"&gt;&lt;span style="font-family:courier new;"&gt;for-label&lt;/span&gt;&lt;/a&gt; imports to construct hypertext links. DrScheme &lt;a href="http://docs.plt-scheme.org/tools/adding-languages.html"&gt;language levels&lt;/a&gt; may &lt;a href="http://docs.plt-scheme.org/tools/drscheme_language.html#%28meth._%28%28%28lib._drscheme/tool-lib..ss%29._drscheme%7E3alanguage%7E3asimple-module-based-language%7E3c%7E25%7E3e%29._get-module%29%29"&gt;provide a module path&lt;/a&gt; for an initial &lt;a href="http://docs.plt-scheme.org/guide/eval.html#%28part._namespaces%29"&gt;namespace&lt;/a&gt;.
&lt;/p&gt;&lt;p&gt;
In each of these cases, we want the module path to refer to the &lt;a href="http://docs.plt-scheme.org/planet/Using_PLaneT.html#%28part._.Fine-.Grained_.Control_.Over_.Package_.Imports%29"&gt;same version&lt;/a&gt; of the same package that it occurs in. On the other hand, we do not want to have to manually search and replace the version number every time we update. Before I solved this problem I would often release some new version x.0 of a package, only to find some lingering dependency on y.0 that my search/replace had not caught. Of course, then I had to go back and replace all occurrences of both x.0 &lt;i&gt;and&lt;/i&gt; y.0 with x.1 and release again. To avoid this headache, we need a way to express self-referential module paths with precise, implicit version numbers.
&lt;/p&gt;&lt;p&gt;
The built-in module paths don't quite support this. The relevant forms are PLaneT paths with version numbers, PLaneT paths without version numbers, and relative paths:
&lt;/p&gt;
&lt;blockquote&gt;&lt;pre&gt;
(planet my/package:1:0/dir/file)
(planet my/package/dir/file)
"../dir/file.ss"
&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;
PLaneT paths with version numbers suffer from the search and replace problem: they become obsolete, and must be changed with every new release.
&lt;/p&gt;&lt;p&gt;
PLaneT paths &lt;i&gt;without&lt;/i&gt; version numbers "upgrade" with a new release: they automatically refer to the latest version of a package.  Unfortunately, this means they aren't really "self"-references.  As soon as version 2.0 is released, every version-free reference to the package refers to 2.0.  Even the references in version 1.0 get implicitly updated, and become forward references rather than self-references.
&lt;/p&gt;&lt;p&gt;
Relative paths are precise, in that they always refer to the same version of the same package. However, because they implicitly refer to the directory containing the source code, they are only valid within a single file.  They cannot be reliably passed to DrScheme for a language level namespace, traced for documentation links by Scribble, or used by other such external tools.
&lt;/p&gt;&lt;p&gt;
None of these options provides precise, stable, externally comprehensible, self-referential module paths.
&lt;/p&gt;&lt;p&gt;
To fill this need, I have released &lt;span style="font-family:courier new;"&gt;(planet &lt;a href="http://planet.plt-scheme.org/package-source/cce/scheme.plt/4/1/planet-docs/main/planet.html"&gt;cce/scheme:4:1/planet&lt;/a&gt;)&lt;/span&gt;. This module provides PLaneT package authors with several macros that construct references to the current package in require imports, Scribble documentation, and dynamic values.  The self-referential modules paths are constructed automatically at compile time based on the &lt;a href="http://docs.plt-scheme.org/reference/stxops.html"&gt;source location&lt;/a&gt; of the macro use and the &lt;a href="http://docs.plt-scheme.org/planet/search-order.html#%28part._.Acceptable_.Local_.Package%29"&gt;local PLaneT package database&lt;/a&gt;.  Their expanded form always includes an explicit package name and version number (both major and minor).  Here I will summarize their use, with &lt;span style="font-family:courier new;"&gt;(planet my/package:1:0/dir/file)&lt;/span&gt; as a running example.  For full details, see the &lt;a href="http://planet.plt-scheme.org/package-source/cce/scheme.plt/4/1/planet-docs/main/index.html"&gt;online documentation&lt;/a&gt; or install the &lt;a href="http://planet.plt-scheme.org/display.ss?package=scheme.plt&amp;amp;owner=cce"&gt;package&lt;/a&gt;.
&lt;/p&gt;&lt;p&gt;
To import a module from within a PLaneT package, use the &lt;span style="font-family:courier new;"&gt;this-package-in&lt;/span&gt; require transformer.  To re-export bindings from a module imported this way, use the &lt;span style="font-family:courier new;"&gt;this-package-out&lt;/span&gt; provide transformer, or use &lt;span style="font-family:courier new;"&gt;require/provide/this-package&lt;/span&gt; in place of both.
&lt;/p&gt;&lt;p&gt;
For example, you might want to import and re-export bindings from &lt;span style="font-family:courier new;"&gt;dir/file&lt;/span&gt;:
&lt;/p&gt;
&lt;blockquote&gt;&lt;pre&gt;
(require (planet my/package:1:0/dir/file))
(provide (all-from-out (planet my/package:1:0/dir/file)))
&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;
You can leave out the package name and version number, thus making the code invariant across upgrades, by writing:
&lt;/p&gt;
&lt;blockquote&gt;&lt;pre&gt;
(require (this-package-in dir/file))
(provide (this-package-out dir/file))
&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;
Or, you can further simplify it:
&lt;/p&gt;
&lt;blockquote&gt;&lt;pre&gt;
(require/provide/this-package dir/file)
&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;
All three of the above are equivalent (in version 1.0).
&lt;/p&gt;&lt;p&gt;
In Scribble documentation, a module often refers to itself via &lt;a href="http://docs.plt-scheme.org/scribble/doc-modules.html#%28form._%28%28lib._scribble/manual..ss%29._defmodule%29%29"&gt;&lt;span style="font-family:courier new;"&gt;defmodule&lt;/span&gt;&lt;/a&gt;, &lt;a href="http://docs.plt-scheme.org/scribble/doc-modules.html#%28form._%28%28lib._scribble/manual..ss%29._declare-exporting%29%29"&gt;&lt;span style="font-family:courier new;"&gt;declare-exporting&lt;/span&gt;&lt;/a&gt;, or &lt;a href="http://docs.plt-scheme.org/scribble/scribble_manual_code.html#%28form._%28%28lib._scribble/manual..ss%29._schememodname%29%29"&gt;&lt;span style="font-family:courier new;"&gt;schememodname&lt;/span&gt;&lt;/a&gt;. I provide the extensions &lt;span style="font-family:courier new;"&gt;defmodule/this-package&lt;/span&gt;, &lt;span style="font-family:courier new;"&gt;declare-exporting/this-package&lt;/span&gt;, and &lt;span style="font-family:courier new;"&gt;schememodname/this-package&lt;/span&gt;, respectively. These macros allow the user to supply a path such as &lt;span style="font-family:courier new;"&gt;dir/file&lt;/span&gt;, or to omit one to refer to the package as a whole (or its main module). In positions where the original macros allow a sequence of module paths, these forms allow two sequences, one for self-referential module paths and one for other paths.
&lt;/p&gt;&lt;p&gt;
To document an entire module, one might first write:
&lt;/p&gt;
&lt;blockquote&gt;&lt;pre&gt;
(defmodule (planet my/package:1:0))
&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;
The automatic self-reference version is simply:
&lt;/p&gt;
&lt;blockquote&gt;&lt;pre&gt;
(defmodule/this-package)
&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;
In more complicated cases, one might document a sub-part of a package or present bindings from multiple sources:
&lt;/p&gt;
&lt;blockquote&gt;&lt;pre&gt;
(defmodule (planet my/package:1:0/dir/file)
  #:use-sources
  [(planet my/package:1:0/private/impl) somewhere/else])
&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;
These self-references can still be automated:
&lt;/p&gt;
&lt;blockquote&gt;&lt;pre&gt;
(defmodule/this-package dir/file
  #:use-sources
  [private/impl]
  [somewhere/else])
&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;
Finally, I provide &lt;span style="font-family:courier new;"&gt;this-package-version-symbol&lt;/span&gt; for constructing PLaneT package symbols as runtime values. This macro is analogous to &lt;a href="http://docs.plt-scheme.org/planet/Utility_Libraries.html#%28form._%28%28lib._planet/util..ss%29._this-package-version%29%29"&gt;&lt;span style="font-family:courier new;"&gt;this-package-version&lt;/span&gt;&lt;/a&gt; from the &lt;a href="http://docs.plt-scheme.org/planet/Utility_Libraries.html#%28mod-path._planet/util%29"&gt;&lt;span style="font-family:courier new;"&gt;planet/util&lt;/span&gt;&lt;/a&gt; collection, but it constructs a symbol rather than an s-expression. You can use this symbol to construct a module path for a DrScheme language level, or escape it with &lt;span style="font-family:courier new;"&gt;unsyntax&lt;/span&gt; in Scribble's &lt;a href="http://docs.plt-scheme.org/scribble/scribble_manual_code.html#%28form._%28%28lib._scribble/manual..ss%29._schemeblock%29%29"&gt;&lt;span style="font-family:courier new;"&gt;schemeblock&lt;/span&gt;&lt;/a&gt; typesetting to create self-referential example code.
&lt;/p&gt;&lt;p&gt;
This list of utilities may not be complete. Users may need to write new macros for self-referential PLaneT packages. To that end, &lt;span style="font-family:courier new;"&gt;(planet &lt;a href="http://planet.plt-scheme.org/package-source/cce/scheme.plt/4/1/planet-docs/main/syntax.html"&gt;cce/scheme:4:1/syntax&lt;/a&gt;)&lt;/span&gt; provides &lt;span style="font-family:courier new;"&gt;syntax-source-planet-package&lt;/span&gt;. This function is analogous to &lt;a href="http://docs.plt-scheme.org/planet/Utility_Libraries.html#%28form._%28%28lib._planet/util..ss%29._this-package-version%29%29"&gt;&lt;span style="font-family:courier new;"&gt;this-package-version&lt;/span&gt;&lt;/a&gt;, but operates on &lt;a href="http://docs.plt-scheme.org/guide/stx-obj.html"&gt;syntax objects&lt;/a&gt; and is designed to be used in &lt;a href="http://docs.plt-scheme.org/guide/proc-macros.html"&gt;macro transformers&lt;/a&gt;. There are also &lt;span style="font-family:courier new;"&gt;-owner&lt;/span&gt;, &lt;span style="font-family:courier new;"&gt;-name&lt;/span&gt;, &lt;span style="font-family:courier new;"&gt;-major&lt;/span&gt;, &lt;span style="font-family:courier new;"&gt;-minor&lt;/span&gt;, and &lt;span style="font-family:courier new;"&gt;-symbol&lt;/span&gt; versions following the same analogy.
&lt;/p&gt;&lt;p&gt;
I find these tools useful for maintaining my PLaneT packages, and I hope other authors will too.  If you do give them a try, please send &lt;a href="http://planet.plt-scheme.org/trac/newticket"&gt;feedback&lt;/a&gt; on what does or doesn't work, or what might be improved.  I would eventually like to add a refined version to the PLT Scheme collections once we get enough experience to know that these tools are fairly complete and usable.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-7043792165582137178?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://planet.plt-scheme.org/package-source/cce/scheme.plt/4/1/planet-docs/main/planet.html' title='Maintaining self-references in Planet packages'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/7043792165582137178/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=7043792165582137178' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/7043792165582137178'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/7043792165582137178'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/03/maintaining-self-references-in-planet.html' title='Maintaining self-references in Planet packages'/><author><name>Carl Eastlund</name><uri>http://www.blogger.com/profile/00965085482378134816</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-7760681962699675417</id><published>2009-02-24T16:06:00.004-05:00</published><updated>2009-02-24T16:24:49.473-05:00</updated><title type='text'>Call for Participation: Writing Typed Scheme wrapper modules</title><content type='html'>&lt;p&gt;Typed Scheme is a language for writing PLT Scheme programs that are statically checked for type errors.  Right now, Typed Scheme handles a large portion of the PLT Scheme language.  However, to use Typed Scheme effectively, we need libraries that work with it.  For this task, we're looking for help.
&lt;/p&gt;

&lt;p&gt;
We'd like volunteers for writing wrapper modules that adapt untyped libraries to Typed Scheme. This task is very easy for the smallest libraries, but can be  much more complicated for larger, complex libraries.
&lt;/p&gt;

&lt;p&gt;
There's a preliminary guide for conversion &lt;a href="http://www.ccs.neu.edu/home/samth/adapt/"&gt;here&lt;/a&gt; and a list of modules to adapt, and their current status is available &lt;a href="http://www.ccs.neu.edu/home/samth/adapt/Current_Status.html"&gt;here&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
Questions about this project, and about developing with Typed Scheme in general, can be asked on &lt;a href="mailto:plt-dev@list.cs.brown.edu"&gt;plt-dev@list.cs.brown.edu&lt;/a&gt; , and questions or comments can be sent directly to me.
&lt;/p&gt;

&lt;p&gt;
We hope to continue making Typed Scheme into a useful tool for PLT Scheme programmers.
&lt;/p&gt;

&lt;p&gt;
Thanks,&lt;br/&gt;
Sam, Stevie, and Matthias&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-7760681962699675417?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/7760681962699675417/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=7760681962699675417' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/7760681962699675417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/7760681962699675417'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/02/call-for-participation-writing-typed.html' title='Call for Participation: Writing Typed Scheme wrapper modules'/><author><name>Sam Tobin-Hochstadt</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-3951894341706705897</id><published>2009-02-18T10:49:00.003-05:00</published><updated>2009-02-18T11:02:53.920-05:00</updated><title type='text'>Steering Scheme</title><content type='html'>&lt;p&gt;Election time is here again. A couple more days and the Scheme community
will have a set of new steer-ers.

&lt;p&gt;&lt;span style="font-weight:bold;"&gt;What should we want from a steering committee? &lt;/span&gt;

&lt;p&gt;I have argued at this place before that good language design needs a
feedback loop. Language designers write down specs; language implementers
translate those specs into compilers and interpreters; programmers use
these implementations to produce useful software. The loop comes in when
implementers inform designers of flaws, inconsistencies, mistakes, errors,
and other internal consistency problems in the specs. This is clearly
happening with R6RS, and it is good. Implementers are a biased bunch,
however. After all, they work on just one kind of program, and in a highly
specialized domain that has been mined for a long time. How can you trust
them? [*]

&lt;p&gt;The loop becomes truly useful when people write large software systems (not
just compilers, because they really are special cases!)  and find that the
language fails them in some way. Such failures can come in a number of
flavors. For a document such as R6RS, we should hope that programmers can
discover problems with porting systems that are apparently due to
ambiguities, flaws, mistakes, roaches in the actual document (as opposed to
a specific implementation). 

&lt;p&gt;&lt;span style="font-weight:bold;"&gt;So what does this have to do with the steering committee? &lt;/span&gt;

&lt;p&gt;The last thing we want from a steering committee is a radical commitment to
change (whatever it may be); a prejudice concerning R6RS; a closed
mind about the size of "Scheme" (it's too large, it's too small); a
willingness to steer without making observations. A steering committee
of overbearing curmudgeons is &lt;em&gt;not&lt;/em&gt; what we want. 

&lt;p&gt;What we do want is a committee that is willing to figure out how the
listening is going to happen; how we can possibly finance a systematic way
of listening (writing NSF grants, anyone?); how the feedback is best
channeled into language design. 

&lt;p&gt;Let's hope we get such a  steering committee. The Scheme community deserves it. 

&lt;hr&gt; 

[*] No I am not naive enough to think that language implementers don't
design languages, and that implementers don't program systems other than
implementations. I am just skeptical that it is easy for them to separate
out their various roles in an objective manner, even if many of them are
able to think at several different levels about programs.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-3951894341706705897?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/3951894341706705897/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=3951894341706705897' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/3951894341706705897'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/3951894341706705897'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/02/steering-scheme.html' title='Steering Scheme'/><author><name>matthias</name><uri>http://www.blogger.com/profile/00000181081270224360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://www.ccs.neu.edu/home/matthias/Images/felleisen1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-8477303771310449675</id><published>2009-02-14T23:35:00.010-05:00</published><updated>2009-02-15T02:18:32.763-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='units'/><category scheme='http://www.blogger.com/atom/ns#' term='contracts'/><title type='text'>New Contract-Related Features</title><content type='html'>&lt;p&gt;In SVN I've added three new major features that involve contracts. One allows for more fine-grained control of contracts, and the other two allow for the use of contracts with signatures and units.&lt;/p&gt;&lt;h4&gt;Contract Regions&lt;/h4&gt;&lt;p&gt;&lt;em&gt;Contract regions&lt;/em&gt; allow the programmer to protect a region of code with a contract boundary.  In addition to the wrapped code, the programmer also provides a name for the region which is used in blame situations and a list of exported variables which can either be protected with contracts or unprotected.  The region provides a true contract boundary, in that uses of contracted exports within the region are unprotected.  Contract regions are specified with the &lt;code&gt;with-contract&lt;/code&gt; form.  The following contract region defines two mutually recursive functions:&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;(with-contract region1
 ([f (-&gt; number? boolean?)]
  [g (-&gt; number? boolean?)])
 (define (f n) (if (zero? n) #f (g (sub1 n))))
 (define (g n) (if (zero? n) #t (f (sub1 n)))))
&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;The internal calls to &lt;code&gt;f&lt;/code&gt; and &lt;code&gt;g&lt;/code&gt; are uncontracted, but calls to &lt;code&gt;f&lt;/code&gt;and &lt;code&gt;g&lt;/code&gt; outside this region would be appropriately contracted.  First-order checks are performed at the region, so the
following region:&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;(with-contract region2
 ([n number?])
 (define n #t))
&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;results in the following error:&lt;/p&gt;&lt;blockquote&gt;&lt;code&gt;(region region2) broke the contract number? on n; expected &amp;lt;number?&amp;gt;, given: #t&lt;/code&gt;&lt;/blockquote&gt;&lt;p&gt;Notice that the blame not only gives the name of the region, but describes what type of contract boundary was involved.&lt;/p&gt;&lt;p&gt;For contracting a single definition, there is the &lt;code&gt;define/contract&lt;/code&gt; form which has a similar syntax to define, except that it takes a
contract before the body of the definition.  To compare the two forms, the following two definitions are equivalent:&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;(with-contract fact
 ([fact (-&gt; number? number?)])
 (define (fact n)
   (if (zero? n) 1 (* n (fact (sub1 n))))))

(define/contract (fact n)
 (-&gt; number? number?)
 (if (zero? n) 1 (* n (fact (sub1 n)))))
&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;First order checks are similarly performed at the definition for
&lt;code&gt;define/contract&lt;/code&gt;, so&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;(define/contract (fact n)
 (-&gt; number?)
 (if (zero? n) 1 (* n (fact (sub1 n)))))
&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;results in&lt;/p&gt;&lt;blockquote&gt;&lt;code&gt;(function fact) broke the contract (-&gt; number?) on fact; expected a procedure that accepts no arguments without any keywords, given: #&amp;lt;procedure:fact&amp;gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;h4&gt;Signature Contracts&lt;/h4&gt;&lt;p&gt;In addition to contract regions, units are also now contract boundaries.  One way to use contracts with units is to add contracts to unit signatures via the contracted &lt;code&gt;signature&lt;/code&gt; form.&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;(define-signature toy-factory^
 ((contracted
   [build-toys (-&gt; integer? (listof toy?))]
   [repaint    (-&gt; toy? symbol? toy?)]
   [toy?       (-&gt; any/c boolean?)]
   [toy-color  (-&gt; toy? symbol?)])))
&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;Notice that contracts in a signature can use variables listed in the signature.&lt;/p&gt;&lt;p&gt;Now if we take the following implementation of that signature:&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;(define-unit simple-factory@
 (import)
 (export toy-factory^)
  
 (define-struct toy (color) #:transparent)
  
 (define (build-toys n)
   (for/list ([i (in-range n)])
     (make-toy 'blue)))
  
 (define (repaint t col)
   (make-toy col)))
&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;We get the appropriate contract checks on those exports:&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;&gt; (define-values/invoke-unit/infer simple-factory@)
&gt; (build-toys 3)
(#(struct:toy blue) #(struct:toy blue) #(struct:toy blue))
&gt; (build-toys #f)
top-level broke the contract (-&gt; integer? (listof toy?))
 on build-toys; expected &lt;integer?&gt;, given: #f
&lt;/integer?&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;As before, uses of contracted exports inside the unit are not checked.&lt;/p&gt;&lt;p&gt;Since units are contract boundaries, they can be blamed appropriately.  Take the following definitions:&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;(define-unit factory-user@
 (import toy-factory^)
 (export)
 (let ([toys (build-toys 3)])
   (repaint 3 'blue)))

(define-compound-unit/infer factory+user@
 (import) (export)
 (link simple-factory@ factory-user@))
&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;When we invoke the combined unit:&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;&gt; (define-values/invoke-unit/infer factory+user@)
(unit factory-user@) broke the contract
 (-&gt; toy? symbol? toy?)
on repaint; expected &lt;toy?&gt;, given: 3
&lt;/toy?&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;h4&gt;Unit Contracts&lt;/h4&gt;&lt;p&gt;However, we may not always be able to add contracts to signatures.  For example, there are many already-existing signatures in PLT Scheme that one may want to implement, or a programmer may want to take a unit value and add contracts to it after the fact.&lt;/p&gt;&lt;p&gt;To do this, there is the &lt;code&gt;unit/c&lt;/code&gt; contract combinator.  It takes a list of imports and exports, where each signature is paired with a list of variables and their contracts for each signature.  So if we had the uncontracted version of the toy-factory^ signature:&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;(define-signature toy-factory^
 (build-toys repaint toy? toy-color))
&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;the following contracts would be appropriate for a unit that imports nothing and exports that signature:&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;(unit/c (import) (export))
(unit/c (import) (export toy-factory^))
(unit/c
 (import)
 (export (toy-factory^
          [toy-color (-&gt; toy? symbol?)])))
(unit/c
 (import)
 (export (toy-factory^
          [build-toys (-&gt; integer? (listof toy?))]
          [repaint    (-&gt; toy? symbol? toy?)]
          [toy?       (-&gt; any/c boolean?)]
          [toy-color  (-&gt; toy? symbol?)])))
&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;Unit contracts can contain a superset of the import signatures and a subset of the export signatures for a given unit value.  Also, variables that are not listed for a given signature are left alone when the contracts are being added.&lt;/p&gt;&lt;p&gt;Since the results of applying &lt;code&gt;unit/c&lt;/code&gt; is a new unit, then adding a contract can cause link inference to fail.  For example, if we change the definition of &lt;code&gt;simple-factory@&lt;/code&gt; above to&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;(define/contract simple-factory@
 (unit/c
  (import)
  (export (toy-factory^
           [build-toys (-&gt; integer? (listof toy?))]
           [repaint    (-&gt; toy? symbol? toy?)]
           [toy?       (-&gt; any/c boolean?)]
           [toy-color  (-&gt; toy? symbol?)])))
 (unit
   (import)
   (export toy-factory^)
  
   (define-struct toy (color) #:transparent)
  
   (define (build-toys n)
     (for/list ([i (in-range n)])
       (make-toy 'blue)))
  
   (define (repaint t col)
     (make-toy col))))
&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;Then when we try to combine it with the &lt;code&gt;factory-user@&lt;/code&gt; unit, we
get:&lt;/p&gt;&lt;blockquote&gt;&lt;code&gt;define-compound-unit/infer: not a unit definition in: simple-factory@&lt;/code&gt;&lt;/blockquote&gt;&lt;p&gt;One way to solve this is to use &lt;code&gt;define-unit-binding&lt;/code&gt; to set up the static information for the new contracted value.  Another possibility for unit definitions is to use &lt;code&gt;define-unit/contract&lt;/code&gt;:&lt;/p&gt;&lt;blockquote&gt;&lt;pre&gt;(define-unit/contract simple-factory@
 (import)
 (export (toy-factory^
          [build-toys (-&gt; integer? (listof toy?))]
          [repaint    (-&gt; toy? symbol? toy?)]
          [toy?       (-&gt; any/c boolean?)]
          [toy-color  (-&gt; toy? symbol?)]))

 (define-struct toy (color) #:transparent)

 (define (build-toys n)
   (for/list ([i (in-range n)])
     (make-toy 'blue)))

 (define (repaint t col)
   (make-toy col)))&lt;/pre&gt;&lt;/blockquote&gt;&lt;p&gt;More about these features can be found in the Reference, and a short section about signature and unit contracts has been added to the Guide.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-8477303771310449675?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/8477303771310449675/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=8477303771310449675' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8477303771310449675'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8477303771310449675'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/02/new-contract-related-features.html' title='New Contract-Related Features'/><author><name>Stevie</name><uri>http://www.blogger.com/profile/08950188991093066574</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-8396356645755951671</id><published>2009-01-29T01:58:00.003-05:00</published><updated>2009-01-29T02:09:58.288-05:00</updated><title type='text'>CfP: Scheme Workshop 2009!</title><content type='html'>&lt;hr&gt;
&lt;h2 align="center"&gt;SCHEME AND FUNCTIONAL PROGRAMMING WORKSHOP 2009&lt;/h2&gt;
&lt;h3 align="center"&gt;Cambridge, Massachusetts&lt;/h3&gt;
&lt;h3 align="center"&gt; August 22, 2009&lt;/h3&gt;
&lt;h3 align="center"&gt;call for papers&lt;/h3&gt;
&lt;h3 align="center"&gt;&lt;a href="http://www.schemeworkshop.org/2009/"&gt;http://www.schemeworkshop.org/2009/&lt;/a&gt;&lt;/h3&gt;
&lt;hr&gt;


&lt;p&gt;The Scheme and Functional Programming Workshop
showcases research and experience related to Scheme,
and more broadly to all aspects of functional
programming.&lt;/p&gt;

&lt;p&gt;Areas of interest include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Language Design, Type Systems, Theory&lt;/li&gt;
&lt;li&gt;Program Development Environments, Education&lt;/li&gt;
&lt;li&gt;Agile Methodologies, Lightweight Software Engineering&lt;/li&gt;
&lt;li&gt;Applications, Implementation, and Experience&lt;/li&gt;
&lt;li&gt;SRFIs!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In addition to technical papers on matters of
programming-language research, we encourage submissions
that present experience or innovation with a particular
project. The key criterion for any paper--technical or
not--is that it makes a contribution from which other
practitioners can benefit.&lt;/p&gt;

&lt;h4&gt;Dates:&lt;/h4&gt;

&lt;p&gt;Dates are firm, and will not be extended.  Please plan
accordingly.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Submission Deadline: June 5, 2009 (FIRM)&lt;/li&gt;
  &lt;li&gt;Author Notification: June 26, 2009&lt;/li&gt;
&lt;li&gt;Final Papers Due: July 24, 2009&lt;/li&gt;
&lt;li&gt;Workshop: August 22, 2009&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Program Committee:&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;John Clements, Cal Poly State University (organizer &amp; chair)&lt;/li&gt;
&lt;li&gt;Dominique Boucher, Nu Echo&lt;/li&gt;
&lt;li&gt;Abdulaziz Ghuloum, Indiana University&lt;/li&gt;
&lt;li&gt;David Herman, Northeastern University&lt;/li&gt;
&lt;li&gt;Shriram Krishnamurthi, Brown University&lt;/li&gt;
&lt;li&gt;Matthew Might, University of Utah&lt;/li&gt;
&lt;li&gt;David Van Horn, Northeastern University&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Publication Policy:&lt;/h4&gt;

&lt;p&gt;Submitted papers must have content that has not
previously been published in other conferences or
refereed venues, and simultaneous submission to other
conferences or refereed venues is unacceptable.&lt;/p&gt;

&lt;p&gt;Publication of a paper at this workshop is not intended
to replace conference or journal publication, and does
not preclude re-publication of a more complete or
finished version of the paper at some later conference
or in a journal.&lt;/p&gt;

&lt;h4&gt;Submission Instructions:&lt;/h4&gt;

&lt;p&gt;Your submissions should be no longer than 12 pages,
including bibliography and appendices. Papers may be
shorter than this limit, and the Program Committee
encourages authors to submit shorter papers where
appropriate.&lt;/p&gt;

&lt;p&gt;The conference web page (URL above) contains detailed
formatting instructions and LaTeX support files.&lt;/p&gt;

&lt;p&gt;Submit your papers using the Continue 2.0 submission
server, at the URL:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://continue2.cs.brown.edu/scheme2009/"&gt;http://continue2.cs.brown.edu/scheme2009/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We look forward to reading your papers!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-8396356645755951671?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://schemeworkshop.org/2009/' title='CfP: Scheme Workshop 2009!'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/8396356645755951671/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=8396356645755951671' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8396356645755951671'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8396356645755951671'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/01/cfp-scheme-workshop-2009.html' title='CfP: Scheme Workshop 2009!'/><author><name>John Clements</name><uri>http://www.blogger.com/profile/10401643794201938443</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-619826297249082925</id><published>2009-01-21T02:20:00.000-05:00</published><updated>2011-11-09T22:52:20.938-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'></title><content type='html'>PLT Scheme version 4.1.4 is now available from
&lt;pre&gt;  &lt;a href="http://plt-scheme.org/"&gt;http://plt-scheme.org/&lt;/a&gt;&lt;/pre&gt;
&lt;ul&gt;&lt;li&gt;New libraries include `scheme/package' (for nestable static modules) and `ffi/objc' (support for Objective-C).&lt;/li&gt;
&lt;li&gt;New teaching support includes a "universe.ss" teachpack for connecting "worlds" over a network.&lt;/li&gt;
&lt;li&gt;Redex now supports automatic test-case generation.  Specify a predicate that should hold of your reduction system, and Redex will attempt to falsify it.  See 'redex-check' in the manual for more details.&lt;/li&gt;
&lt;li&gt;Improvements to the run-time system include better and more reliable memory-limit tracking, function contracts that preserve tail recursion in many cases, native debugging backtraces on x86_64, and performance improvements.&lt;/li&gt;
&lt;li&gt;Improved libraries include enhancements to `scheme/sandbox', better handling of zero-sized matches by `regexp-split' and friends, an `equal&lt;%&gt;' interface for specifying equality on class instances (and more general support for attaching properties to interfaces), equality (via `equal&lt;%&gt;') for image objects, and refinements to `scheme/foreign' to support atomic operations and function-pointer conversions.&lt;/li&gt;&lt;/ul&gt;

[Note that mirror sites can take a while to catch up with the new downloads.]

Feedback Welcome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-619826297249082925?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/619826297249082925/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=619826297249082925' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/619826297249082925'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/619826297249082925'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2009/01/plt-scheme-version-4.html' title=''/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-7007357599951577374</id><published>2008-11-24T17:19:00.019-05:00</published><updated>2008-11-24T19:08:21.658-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='planet'/><title type='text'>Simple GnuPLoTting</title><content type='html'>&lt;p&gt;&lt;a href="http://www.gnuplot.info/"&gt;gnuplot&lt;/a&gt; is a very powerful and widely used interactive data plotting  program. It can generate two-dimenational and three-dimensional surface plots, either on screen  or print to files with a wide-array of supported formats. If you are not familiar with it, you can get an idea of its capabilities &lt;a href="http://gnuplot.sourceforge.net/demo/"&gt;here&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;A new package, &lt;a href="http://planet.plt-scheme.org/display.ss?package=gnuplot.plt&amp;owner=vyzo"&gt;gnuplot.plt&lt;/a&gt;, is now available on planet which allows you to programmatically interact with gnuplot processes and generate plots on the fly. The package provides a simple interface that abstracts gnuplot's quirky syntax and takes care of data marshalling using temporary files.&lt;/p&gt;

&lt;p&gt;Without further ado, here is to every computer scientist's favorite growth curves:
&lt;/p&gt;
&lt;div class="scheme"&gt;&lt;pre&gt;(&lt;span class="keyword"&gt;require&lt;/span&gt; (&lt;span class="variable"&gt;planet&lt;/span&gt; &lt;span class="variable"&gt;vyzo/gnuplot&lt;/span&gt;))
(&lt;span class="keyword"&gt;define&lt;/span&gt; &lt;span class="variable"&gt;gplot&lt;/span&gt; (&lt;span class="variable"&gt;gnuplot-spawn&lt;/span&gt;))
(&lt;span class="keyword"&gt;define&lt;/span&gt; &lt;span class="variable"&gt;data&lt;/span&gt; 
  (&lt;span class="variable"&gt;gnuplot-data&lt;/span&gt;
   (&lt;span class="variable"&gt;build-list&lt;/span&gt; &lt;span class="selfeval"&gt;90&lt;/span&gt;
     (&lt;span class="keyword"&gt;lambda&lt;/span&gt; (&lt;span class="variable"&gt;x&lt;/span&gt;) 
       (&lt;span class="keyword"&gt;let&lt;/span&gt; ((&lt;span class="variable"&gt;x&lt;/span&gt; (&lt;span class="builtin"&gt;add1&lt;/span&gt; (&lt;span class="builtin"&gt;/&lt;/span&gt; &lt;span class="variable"&gt;x&lt;/span&gt; &lt;span class="selfeval"&gt;10.&lt;/span&gt;))))
         (&lt;span class="builtin"&gt;list&lt;/span&gt; &lt;span class="variable"&gt;x&lt;/span&gt; (&lt;span class="builtin"&gt;log&lt;/span&gt; &lt;span class="variable"&gt;x&lt;/span&gt;) (&lt;span class="builtin"&gt;*&lt;/span&gt; &lt;span class="variable"&gt;x&lt;/span&gt; (&lt;span class="builtin"&gt;log&lt;/span&gt; &lt;span class="variable"&gt;x&lt;/span&gt;)) (&lt;span class="builtin"&gt;expt&lt;/span&gt; &lt;span class="variable"&gt;x&lt;/span&gt; &lt;span class="selfeval"&gt;2&lt;/span&gt;) (&lt;span class="builtin"&gt;expt&lt;/span&gt; &lt;span class="selfeval"&gt;2&lt;/span&gt; &lt;span class="variable"&gt;x&lt;/span&gt;)))))))
&lt;span class="comment"&gt;;; png output options
&lt;/span&gt;(&lt;span class="keyword"&gt;define&lt;/span&gt; &lt;span class="variable"&gt;png&lt;/span&gt; &lt;span class="keyword"&gt;'&lt;/span&gt;(&lt;span class="variable"&gt;png&lt;/span&gt; &lt;span class="variable"&gt;enhanced&lt;/span&gt; &lt;span class="variable"&gt;transparent&lt;/span&gt; &lt;span class="variable"&gt;font&lt;/span&gt; (&lt;span class="variable"&gt;str&lt;/span&gt; &lt;span class="variable"&gt;arial&lt;/span&gt;)))
&lt;span class="comment"&gt;;; on screen plot
&lt;/span&gt;(&lt;span class="variable"&gt;gnuplot-set&lt;/span&gt; &lt;span class="variable"&gt;gplot&lt;/span&gt; &lt;span class="keyword"&gt;'&lt;/span&gt;(&lt;span class="variable"&gt;title&lt;/span&gt; (&lt;span class="variable"&gt;str&lt;/span&gt; &lt;span class="selfeval"&gt;"growth curves"&lt;/span&gt;)))
(&lt;span class="variable"&gt;gnuplot-plot&lt;/span&gt; &lt;span class="variable"&gt;gplot&lt;/span&gt; 
  &lt;span class="variable"&gt;#:range&lt;/span&gt; &lt;span class="keyword"&gt;'&lt;/span&gt;(() (&lt;span class="selfeval"&gt;1&lt;/span&gt; &lt;span class="selfeval"&gt;1000&lt;/span&gt;))
  (&lt;span class="variable"&gt;gnuplot-item&lt;/span&gt; &lt;span class="variable"&gt;data&lt;/span&gt; &lt;span class="keyword"&gt;'&lt;/span&gt;(&lt;span class="variable"&gt;using&lt;/span&gt; (&lt;span class="variable"&gt;seq:&lt;/span&gt; &lt;span class="selfeval"&gt;1&lt;/span&gt; &lt;span class="selfeval"&gt;1&lt;/span&gt;) &lt;span class="variable"&gt;title&lt;/span&gt; (&lt;span class="variable"&gt;str&lt;/span&gt; &lt;span class="selfeval"&gt;"x"&lt;/span&gt;) &lt;span class="variable"&gt;with&lt;/span&gt; &lt;span class="variable"&gt;line&lt;/span&gt;))
  (&lt;span class="variable"&gt;gnuplot-item&lt;/span&gt; &lt;span class="variable"&gt;data&lt;/span&gt; &lt;span class="keyword"&gt;'&lt;/span&gt;(&lt;span class="variable"&gt;using&lt;/span&gt; (&lt;span class="variable"&gt;seq:&lt;/span&gt; &lt;span class="selfeval"&gt;1&lt;/span&gt; &lt;span class="selfeval"&gt;2&lt;/span&gt;) &lt;span class="variable"&gt;title&lt;/span&gt; (&lt;span class="variable"&gt;str&lt;/span&gt; &lt;span class="selfeval"&gt;"log(x)"&lt;/span&gt;) &lt;span class="variable"&gt;with&lt;/span&gt; &lt;span class="variable"&gt;line&lt;/span&gt;))
  (&lt;span class="variable"&gt;gnuplot-item&lt;/span&gt; &lt;span class="variable"&gt;data&lt;/span&gt; &lt;span class="keyword"&gt;'&lt;/span&gt;(&lt;span class="variable"&gt;using&lt;/span&gt; (&lt;span class="variable"&gt;seq:&lt;/span&gt; &lt;span class="selfeval"&gt;1&lt;/span&gt; &lt;span class="selfeval"&gt;3&lt;/span&gt;) &lt;span class="variable"&gt;title&lt;/span&gt; (&lt;span class="variable"&gt;str&lt;/span&gt; &lt;span class="selfeval"&gt;"xlog(x)"&lt;/span&gt;) &lt;span class="variable"&gt;with&lt;/span&gt; &lt;span class="variable"&gt;line&lt;/span&gt;))
  (&lt;span class="variable"&gt;gnuplot-item&lt;/span&gt; &lt;span class="variable"&gt;data&lt;/span&gt; &lt;span class="keyword"&gt;'&lt;/span&gt;(&lt;span class="variable"&gt;using&lt;/span&gt; (&lt;span class="variable"&gt;seq:&lt;/span&gt; &lt;span class="selfeval"&gt;1&lt;/span&gt; &lt;span class="selfeval"&gt;4&lt;/span&gt;) &lt;span class="variable"&gt;title&lt;/span&gt; (&lt;span class="variable"&gt;str&lt;/span&gt; &lt;span class="selfeval"&gt;"x^2"&lt;/span&gt;) &lt;span class="variable"&gt;with&lt;/span&gt; &lt;span class="variable"&gt;line&lt;/span&gt;))
  (&lt;span class="variable"&gt;gnuplot-item&lt;/span&gt; &lt;span class="variable"&gt;data&lt;/span&gt; &lt;span class="keyword"&gt;'&lt;/span&gt;(&lt;span class="variable"&gt;using&lt;/span&gt; (&lt;span class="variable"&gt;seq:&lt;/span&gt; &lt;span class="selfeval"&gt;1&lt;/span&gt; &lt;span class="selfeval"&gt;5&lt;/span&gt;) &lt;span class="variable"&gt;title&lt;/span&gt; (&lt;span class="variable"&gt;str&lt;/span&gt; &lt;span class="selfeval"&gt;"2^x"&lt;/span&gt;) &lt;span class="variable"&gt;with&lt;/span&gt; &lt;span class="variable"&gt;line&lt;/span&gt;)))
&lt;span class="comment"&gt;;; replot to png
&lt;/span&gt;(&lt;span class="variable"&gt;gnuplot-hardcopy&lt;/span&gt; &lt;span class="variable"&gt;gplot&lt;/span&gt; &lt;span class="selfeval"&gt;"/tmp/grow.png"&lt;/span&gt; &lt;span class="variable"&gt;#:term&lt;/span&gt; &lt;span class="variable"&gt;png&lt;/span&gt;)
&lt;span class="comment"&gt;;; redo with logscale
&lt;/span&gt;(&lt;span class="variable"&gt;gnuplot-set&lt;/span&gt; &lt;span class="variable"&gt;gplot&lt;/span&gt; &lt;span class="keyword"&gt;'&lt;/span&gt;(&lt;span class="variable"&gt;logscale&lt;/span&gt; &lt;span class="variable"&gt;y&lt;/span&gt;))
(&lt;span class="variable"&gt;gnuplot-replot&lt;/span&gt; &lt;span class="variable"&gt;gplot&lt;/span&gt;)
(&lt;span class="variable"&gt;gnuplot-hardcopy&lt;/span&gt; &lt;span class="variable"&gt;gplot&lt;/span&gt; &lt;span class="selfeval"&gt;"/tmp/loggrow.png"&lt;/span&gt; &lt;span class="variable"&gt;#:term&lt;/span&gt; &lt;span class="variable"&gt;png&lt;/span&gt;)
&lt;/pre&gt;&lt;/div&gt;

&lt;table&gt;&lt;tr&gt;
&lt;td&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_z9qlvFJLavM/SSs-MWx-soI/AAAAAAAAAAM/Q390WvIaCYQ/s1600-h/grow.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 200px; height: 150px;" src="http://1.bp.blogspot.com/_z9qlvFJLavM/SSs-MWx-soI/AAAAAAAAAAM/Q390WvIaCYQ/s200/grow.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5272376170761859714" /&gt;&lt;/a&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_z9qlvFJLavM/SSs-Mc58DXI/AAAAAAAAAAU/OisUht4uV5I/s1600-h/loggrow.png"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 200px; height: 150px;" src="http://3.bp.blogspot.com/_z9qlvFJLavM/SSs-Mc58DXI/AAAAAAAAAAU/OisUht4uV5I/s200/loggrow.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5272376172405853554" /&gt;&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-7007357599951577374?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/7007357599951577374/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=7007357599951577374' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/7007357599951577374'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/7007357599951577374'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2008/11/simple-gnuplotting.html' title='Simple GnuPLoTting'/><author><name>vyzo</name><uri>http://www.blogger.com/profile/11156244128400372973</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_z9qlvFJLavM/SSs-MWx-soI/AAAAAAAAAAM/Q390WvIaCYQ/s72-c/grow.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-7126646559691060317</id><published>2008-11-21T11:04:00.001-05:00</published><updated>2011-11-09T22:52:20.960-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>PLT Scheme v4.1.3</title><content type='html'>PLT Scheme version 4.1.3 is now available from
&lt;pre&gt;  &lt;a href="http://plt-scheme.org/"&gt;http://plt-scheme.org/&lt;/a&gt;&lt;/pre&gt;
This is a bug-fix release.

Notable changes:

&lt;ul&gt;&lt;li&gt;Web Server:&lt;ul&gt;&lt;li&gt;Documentation rewritten to separate servlet APIs and server extension APIs&lt;/li&gt;&lt;li&gt;HTTPS supported on the "plt-web-server" command-line with "--ssl" option&lt;/li&gt;&lt;li&gt;Stateless servlets supported in default configuration through 'stateless interface-version&lt;/li&gt;&lt;li&gt;`web-server/servlet-env' supports top-level servlets through #:servlet-path&lt;/li&gt;&lt;li&gt;Servlets are served from anywhere in the htdocs directory by default&lt;/li&gt;&lt;li&gt;A template system based on the Scribble syntax has been added, see web-server/templates in the documentation&lt;/li&gt;&lt;/ul&gt;And many other internal modifications to make extension easier!&lt;/li&gt;&lt;/ul&gt;

[Note that mirror sites can take a while to catch up with the new downloads.]

Feedback Welcome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-7126646559691060317?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://plt-scheme.org/' title='PLT Scheme v4.1.3'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/7126646559691060317/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=7126646559691060317' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/7126646559691060317'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/7126646559691060317'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2008/11/plt-scheme-v413.html' title='PLT Scheme v4.1.3'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-2682339340541125231</id><published>2008-10-28T14:29:00.001-04:00</published><updated>2011-11-09T22:52:20.914-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'></title><content type='html'>PLT Scheme version 4.1.2 is now available from
&lt;pre&gt;  &lt;a href="http://plt-scheme.org/"&gt;http://plt-scheme.org/&lt;/a&gt;&lt;/pre&gt;
This is a bug-fix release.

[Note that mirror sites can take a while to catch up with the new downloads.]

Feedback Welcome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-2682339340541125231?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/2682339340541125231/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=2682339340541125231' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2682339340541125231'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2682339340541125231'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2008/10/plt-scheme-version-4.html' title=''/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-2747116959164987330</id><published>2008-10-06T15:33:00.006-04:00</published><updated>2009-03-12T11:54:55.912-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tutorials'/><category scheme='http://www.blogger.com/atom/ns#' term='drscheme'/><category scheme='http://www.blogger.com/atom/ns#' term='documentation'/><category scheme='http://www.blogger.com/atom/ns#' term='web-server'/><category scheme='http://www.blogger.com/atom/ns#' term='continuations'/><title type='text'>Web Application Development in PLT Scheme</title><content type='html'>&lt;p&gt;Many users often post to the &lt;code&gt;plt-scheme&lt;/code&gt; mailing list asking for introductions to Web application development in PLT Scheme. They've heard of the continuation-based PLT Web Server and want a gentle introduction. Unfortunately, there has been a distinct lack of good documentation and tutorials for the server. Taking the cue from two users: &lt;a href="http://www.scheme.dk/blog/2007/01/introduction-to-web-development-with.html"&gt;Jens Axel Soegaard&lt;/a&gt; and &lt;a href="http://alwaysmovefast.com/category/plt-scheme/"&gt;David Reynolds&lt;/a&gt;, we've written a tutorial with Danny Yoo.&lt;/p&gt;

&lt;p&gt;The tutorial is available at &lt;a href="http://docs.plt-scheme.org/continue/index.html"&gt;http://docs.plt-scheme.org/continue/index.html&lt;/a&gt;. It walks through the creation of a blog application, introducing features slowly and culminates in an SQL-backed database for the posts. Of particular interest, is the &lt;a href="http://docs.plt-scheme.org/web-server/insta.html"&gt;fast start servlet setup&lt;/a&gt; based on the Instaservlet package from &lt;a href="http://www.untyped.com/"&gt;Untyped&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Please take a look and pass along this as a pointer to those who may be interested in PLT Scheme.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-2747116959164987330?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://docs.plt-scheme.org/continue/index.html' title='Web Application Development in PLT Scheme'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/2747116959164987330/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=2747116959164987330' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2747116959164987330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2747116959164987330'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2008/10/web-application-development-in-plt.html' title='Web Application Development in PLT Scheme'/><author><name>Jay McCarthy</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-13KUDv8LhZw/AAAAAAAAAAI/AAAAAAAAAAA/7MdiB5POU5k/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-6517702731644563759</id><published>2008-10-05T16:34:00.001-04:00</published><updated>2011-11-09T22:52:20.944-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>PLT Scheme v4.1.1</title><content type='html'>PLT Scheme version 4.1.1 is now available from
&lt;pre&gt;  &lt;a href="http://plt-scheme.org/"&gt;http://plt-scheme.org/&lt;/a&gt;&lt;/pre&gt;Notable changes:&lt;ul&gt;&lt;li&gt;web-server: New servlet development tutorial; quick launching of servlets from DrScheme via the `web-server/insta' language; new form abstraction through formlets.&lt;/li&gt;&lt;li&gt;misc: mzc can "decompile" bytecode files; `#lang' lines wired to the top of DrScheme's definition window; improved searching in DrScheme; some foreign interface extensions.&lt;/li&gt;&lt;/ul&gt;[Note that mirror sites can take a while to catch up with the new downloads.]

Feedback Welcome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-6517702731644563759?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://plt-scheme.org/' title='PLT Scheme v4.1.1'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/6517702731644563759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=6517702731644563759' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/6517702731644563759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/6517702731644563759'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2008/10/plt-scheme-v411.html' title='PLT Scheme v4.1.1'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-7293458638491379663</id><published>2008-08-12T16:32:00.002-04:00</published><updated>2011-11-09T22:52:20.964-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>PLT Scheme v4.1</title><content type='html'>PLT Scheme version 4.1 is now available from
&lt;pre&gt;  &lt;a href="http://plt-scheme.org/"&gt;http://plt-scheme.org/&lt;/a&gt;&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;DrScheme changes:&lt;ul&gt;&lt;li&gt;The Module language now has an automatically inserted &lt;tt&gt;#lang&lt;/tt&gt; declaration, so the interactions window is available right away for new windows.&lt;/li&gt;&lt;li&gt;Searching is now interactive (see the manual for details).&lt;/li&gt;&lt;li&gt;Memory limits are now enabled by default.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Typed Scheme supports a novel type checking mechanism for homogeneous and heterogeneous variable-arity function definitions and applications.&lt;/li&gt;&lt;li&gt;Redex (a domain-specific language for testing operational semantics) is now included in the distribution. See also &lt;tt&gt;&lt;a href="http://redex.plt-scheme.org/"&gt;redex.plt-scheme.org&lt;/a&gt;&lt;/tt&gt;.&lt;/li&gt;&lt;li&gt;Lots of improvement to the documentation, including: better searching, table-of-contents, and language-sensitive help (in the teaching languages).&lt;/li&gt;&lt;li&gt;The world.ss teachpack no longer supports &lt;tt&gt;end-of-time&lt;/tt&gt;, only &lt;tt&gt;stop-when&lt;/tt&gt;.&lt;/li&gt;&lt;li&gt;MzScheme has now a logging facility, search the documentationfor "logger" for more details.&lt;/li&gt;&lt;li&gt;Bug fixes:&lt;ul&gt;&lt;li&gt;&lt;tt&gt;begin&lt;/tt&gt; in R5RS (and derived languages),&lt;/li&gt;&lt;li&gt;&lt;tt&gt;#lang planet&lt;/tt&gt;,&lt;/li&gt;&lt;li&gt;&lt;tt&gt;eval&lt;/tt&gt; works with phases.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;Feedback Welcome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-7293458638491379663?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/7293458638491379663/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=7293458638491379663' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/7293458638491379663'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/7293458638491379663'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2008/08/plt-scheme-v41.html' title='PLT Scheme v4.1'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-3416142740906973366</id><published>2008-07-29T18:10:00.011-04:00</published><updated>2008-07-30T00:09:34.979-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='keybindings'/><category scheme='http://www.blogger.com/atom/ns#' term='drscheme'/><title type='text'>Search in DrScheme</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_gJUvnpacURg/SI-cUBJB31I/AAAAAAAAADw/k434suYJVQI/s1600-h/Picture+5.png"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" src="http://bp2.blogger.com/_gJUvnpacURg/SI-cUBJB31I/AAAAAAAAADw/k434suYJVQI/s320/Picture+5.png" alt="" id="BLOGGER_PHOTO_ID_5228569560118058834" border="0" /&gt;&lt;/a&gt;
I've just overhauled search in DrScheme. Instead of popping up a dialog box and asking you for a search string, you get a new editor along the bottom of the DrScheme window where you can type a search string and DrScheme responds by circling (in purple) all of the occurrences of the search string in the file, both in the main window and in the contour window.

&lt;p&gt;
From there, you can use the new menu shortcuts to navigate forwards and backwards through the hits, optionally replacing occurrences of the search string with the replace strings (see the Edit menu).
&lt;/p&gt;

&lt;p&gt;
With the default settings, typing a search string does not move around in the main window. Specifically (unlike Emacs, Safari, or Firefox), you don't move immediately to the first occurrence of the search string. You have to hit return or one of the search keys (in the Edit menu) for that to happen. But you can enable this in the General pane
of the Editing tab in the preferences dialog. Click on "Search using anchors". Now, when you search for a string, DrScheme will whizz you right to it and when you edit the search string, DrScheme will shift the insertion point based on the search string. In order for you to keep track of where edits will go, you'll see a funny looking little red dongle in your text. That's where the insertion point was when you
started your search, and that's where DrScheme starts all of these implicit searches from.
&lt;/p&gt;
&lt;p&gt;
Try it out and let us know what you think! In particular, is the anchor-based search or the non-anchor-based search more intuitive for you?
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-3416142740906973366?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/3416142740906973366/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=3416142740906973366' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/3416142740906973366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/3416142740906973366'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2008/07/search-in-drscheme.html' title='Search in DrScheme'/><author><name>Robby</name><uri>http://www.blogger.com/profile/08402308775580442837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='13' height='32' src='http://people.cs.uchicago.edu/~robby/portrait-2006.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp2.blogger.com/_gJUvnpacURg/SI-cUBJB31I/AAAAAAAAADw/k434suYJVQI/s72-c/Picture+5.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-1280588230791861473</id><published>2008-07-04T21:05:00.002-04:00</published><updated>2011-11-09T22:52:20.890-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'></title><content type='html'>PLT Scheme version 4.0.2 is now available from

&lt;pre&gt;  &lt;a href="http://plt-scheme.org/"&gt;http://plt-scheme.org/&lt;/a&gt;&lt;/pre&gt;
This release fixes a bug that caused PLaneT packages to install abnormally slow in 4.0.1.

[ For those that use the nightly builds, subversion, or 4.0.1tsrj2008, you already have this fix (and even more fixes). You do not need to upgrade.  The version in svn is now 4.0.2.3 to minimize confusion. ]

Feedback Welcome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-1280588230791861473?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/1280588230791861473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=1280588230791861473' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1280588230791861473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1280588230791861473'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2008/07/plt-scheme-version-4.html' title=''/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-2394879006392807599</id><published>2008-06-22T23:49:00.001-04:00</published><updated>2011-11-09T22:52:20.902-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>PLT Scheme v4.0.1</title><content type='html'>PLT Scheme version 4.0.1 is now available from

  &lt;tt&gt;&lt;a href="http://plt-scheme.org/"&gt;http://plt-scheme.org/&lt;/a&gt;&lt;/tt&gt;

This release fixes a number of bugs.  Most noteworthy, the "Internal Error" message when requiring a PLaneT package has been fixed and user-defined teachpacks now work properly.

Feedback Welcome.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-2394879006392807599?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/2394879006392807599/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=2394879006392807599' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2394879006392807599'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2394879006392807599'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2008/06/plt-scheme-v401.html' title='PLT Scheme v4.0.1'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-4036024601885652110</id><published>2008-06-12T02:11:00.002-04:00</published><updated>2011-11-09T22:52:20.922-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'></title><content type='html'>PLT Scheme version 4.0 is now available from
&lt;blockquote&gt;&lt;tt&gt;&lt;a href="http://plt-scheme.org/"&gt;http://plt-scheme.org/&lt;/a&gt;&lt;/tt&gt;&lt;/blockquote&gt;
This major new release offers many improvements over version 372, and we encourage everyone to upgrade.
&lt;ul&gt;
&lt;li&gt;The PLT Scheme language now provides better syntax for modules, better support for optional and keyword arguments to functions, a more complete syntax for structure types, new syntax for list comprehensions and iterations, a more complete and consistent set of list operations, a more complete set of string operations, and streamlined hash-table operations.&lt;/li&gt;
&lt;li&gt;The documentation has been re-organized and re-written.  New tutorials and overviews offer a clearer introduction to Scheme and PLT Scheme.&lt;/li&gt;
&lt;li&gt;New documentation tools help programmers create and install documentation for libraries and Planet packages.  All installed documentation can be read though the user's web browser, and even searching within the browser works on local files.&lt;br&gt;
The language for writing documentation is an extension of Scheme, and document sources are linked to implementations through the module system.  The module connection allows, for example, reliable automatic hyperlinking of identifiers mentioned in documentation to their specifications in other documentation.&lt;/li&gt;
&lt;li&gt;R6RS programs are supported in two ways: though the &lt;tt&gt;plt-r6rs&lt;/tt&gt; executable and through the &lt;tt&gt;#!r6rs&lt;/tt&gt; prefix.  The latter allows an R6RS library or program to serve as a PLT Scheme module.&lt;/li&gt;
&lt;li&gt;Legacy R5RS support is improved, partly through a separate &lt;tt&gt;plt-r5rs&lt;/tt&gt; executable.&lt;/li&gt;
&lt;li&gt;Pairs are immutable within the PLT Scheme language; mutable pairs (which are the same as R6RS and R5RS pairs) are provided as a separate datatype. For more information, see &amp;ldquo;&lt;a href="http://blog.plt-scheme.org/2007/11/getting-rid-of-set-car-and-set-cdr.html"&gt;Getting rid of &lt;tt&gt;set-car!&lt;/tt&gt; and &lt;tt&gt;set-cdr!&lt;/tt&gt;&lt;/a&gt;&amp;rdquo;&lt;/li&gt;
&lt;li&gt;ProfessorJ uses a new and improved parser, it evaluates programs faster, and it includes a Java-specific indenter.&lt;/li&gt;
&lt;li&gt;Testing frameworks for the HtDP and HtDC (ProfessorJ) teaching languages have been unified. Both support systematic unit testing in a comprehensive fashion. When programs lack tests, students are asked to add test cases.  When all tests succeed, a simple message says so; otherwise, a pop-up window (dockable) displays URLs to the failed test cases and explains why the cases failed.&lt;/li&gt;
&lt;li&gt;Typed Scheme, a statically typed dialect of Scheme, is now included with PLT Scheme.  While Typed Scheme is still in its early stages of development, it supports modular programming with types and full interaction with existing untyped code.  Safe interactions between typed and untyped modules are enforced via contracts.  Typed Scheme also features a novel type system designed to accommodate Scheme programming idioms.  For more information, see the &lt;a href="http://www.ccs.neu.edu/~samth/typed-scheme/"&gt;Typed Scheme&lt;/a&gt; page.&lt;/li&gt;
&lt;/ul&gt;
&lt;i&gt;Feedback Welcome.&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-4036024601885652110?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/4036024601885652110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=4036024601885652110' title='16 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/4036024601885652110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/4036024601885652110'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2008/06/plt-scheme-version-4.html' title=''/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>16</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-6087611645085889801</id><published>2008-06-06T21:40:00.002-04:00</published><updated>2008-06-06T21:44:30.027-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='drscheme'/><title type='text'>The Tour in Video</title><content type='html'>&lt;p&gt;
Putting behind its stodgy textual past, the DrScheme tour is now
&lt;a href="http://www.youtube.com/watch?v=vgQO_kHl39g"&gt;in video&lt;/a&gt;!
It's rather preliminary, and can use lots of improvement, but now
we're really taking it to the kids.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-6087611645085889801?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/6087611645085889801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=6087611645085889801' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/6087611645085889801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/6087611645085889801'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2008/06/tour-in-video.html' title='The Tour in Video'/><author><name>Shriram Krishnamurthi</name><uri>http://www.blogger.com/profile/02956763366608000839</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-266784924007072869</id><published>2008-06-03T18:03:00.003-04:00</published><updated>2011-11-09T22:52:20.910-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>PLT Scheme version 4.0 is Coming Soon</title><content type='html'>&lt;p&gt;PLT Scheme is now 13 years old. The initial version was little more than glue code between a few open-source libraries, which seemed to offer the quickest solution to our modest goals. Modest success leads to bigger goals, however, and then continued success leads to ever more ambitious goals. Before you know it, a mass of users, co-developers, libraries, and documentation rely on design decisions that were made for a much smaller project years before.&lt;/p&gt;

&lt;p&gt;Naturally, many of those early design decisions turn out to be a poor fit for the project&amp;rsquo;s eventual role. Starting from scratch isn&amp;rsquo;t usually practical, so you gradually adjust the infrastructure to meet new needs. That was precisely the story for the version 300 series of releases for PLT Scheme. The biggest gap between our original and current goals was in run-time performance, so we replaced bytecode interpretation with a just-in-time native-code compiler, and we replaced a memory manager based on &amp;ldquo;conservative&amp;rdquo; estimates of pointer usage with one that uses precise information.&lt;/p&gt;

&lt;p&gt;Performance improves a bit more with version 4.0, but mostly we&amp;rsquo;ve moved on to a bigger mismatch between the original and current goals: the way that PLT Scheme presents itself to users. PLT Scheme was originally conceived as R5RS Scheme with some extensions to make it practical, and with useful tools (notably an IDE) and libraries (notably a GUI library) built on that core. Our documentation and web pages reflected that architecture &amp;ndash; which now seems completely upside-down.&lt;/p&gt;

&lt;P&gt;Version 4.0 is a fresh start in the way that we present PLT Scheme. It&amp;rsquo;s a new language. PLT Scheme is a dialect of Scheme, certainly, but it&amp;rsquo;s not merely a superset of R5RS, R6RS, or other standards, and those standards are not really the best place to start understanding PLT Scheme. At the same time, the unique extensibility features of the PLT Scheme language and tools allow them to support other languages easily, including R5RS (though a new &lt;tt&gt;plt-r5rs&lt;/tt&gt; executable), R6RS, and more.&lt;/p&gt;

&lt;p&gt;Improvements to the PLT Scheme language include better syntax for modules, better support for optional and keyword function arguments, more expressive syntax for structure types, streamlined hash-table operations, new syntax for list comprehensions and iterations, a more complete and consistent set of list and string operations, and reduced dependence on mutable pairs. To current users of PLT Scheme, these changes will seem like the big ones behind version 4.0, but they&amp;rsquo;re small compared to the overall re-organization and the accompanying documentation effort.&lt;/p&gt;

&lt;p&gt;We wrote hundreds of pages of new documentation, including much more tutorial and overview information. We ported hundreds of pages of existing documents to new a system that produces cleaner, better organized, more consistent output. We will replace the old tangle of web pages (that try to explain a confusing federation of tools) with a simple page about &amp;ldquo;PLT Scheme.&amp;rdquo; We have even streamlined the command-line flags for the main virtual machine.&lt;/p&gt;

&lt;p&gt;The development of PLT Scheme version 4.0 took about one year of hard work. In retrospect, that doesn&amp;rsquo;t sound too bad, considering the scale of the existing code base, the number of things that we improved, and the total size of the documentation (about 2000 pages in PDF form). Still, you can imagine how happy we are to arrive at a stable release, and we hope that the improvements in PLT Scheme version 4.0 work as well for everyone else as they do for us.&lt;/p&gt;

&lt;p&gt;For a preview, see &lt;a href="http://pre.plt-scheme.org/"&gt;http://pre.plt-scheme.org/&lt;/a&gt;. The final version 4.0 release is just days away.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-266784924007072869?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/266784924007072869/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=266784924007072869' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/266784924007072869'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/266784924007072869'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2008/06/plt-scheme-version-40-is-coming-soon.html' title='PLT Scheme version 4.0 is Coming Soon'/><author><name>Matthew Flatt</name><uri>http://www.blogger.com/profile/03369511886823036667</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-903780350920969233</id><published>2008-02-23T01:20:00.002-05:00</published><updated>2008-02-23T01:33:16.469-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='macros'/><title type='text'>Dirty Looking Hygiene</title><content type='html'>With the recent release of &lt;a href="http://arclanguage.com/"&gt;Arc&lt;/a&gt;, there has been some discussion over hygienic macros.  Yes, hygienic macros are usually very convenient, but they can become messy in some &amp;lsquo;corner&amp;rsquo; cases.  People who learn about macros in Scheme usually start with &lt;code&gt;syntax-rules&lt;/code&gt;, and being the limited tool that it is, they often get the impression that for advanced uses (like a macro that captures an identifier) you need to use &lt;code&gt;syntax-case&lt;/code&gt; which is this &amp;ldquo;really obscure thing&amp;rdquo;.

For example, say that we want to implement an &lt;code&gt;if&lt;/code&gt; form that is similar to Arc's &lt;code&gt;if&lt;/code&gt;.  This is pretty easy using &lt;code&gt;syntax-rules&lt;/code&gt;:&lt;pre&gt;  (define-syntax if*
    (syntax-rules ()
      [(if*) (void)]
      [(if* X) X]
      [(if* C X more ...) (if C X (if* more ...))]))&lt;/pre&gt;But more important than being easy to write: it is also easy to read. In fact, the nice thing about &lt;code&gt;syntax-rules&lt;/code&gt; is that you write more or less the specification of your transformation.  Compare this to the specification of Arc's &lt;code&gt;if&lt;/code&gt;, which appears in a comment before the definition of &lt;code&gt;ac-if&lt;/code&gt; in &amp;ldquo;&lt;tt&gt;ac.scm&lt;/tt&gt;&amp;rdquo;:&lt;pre&gt;  ; (if) -&gt; nil
  ; (if x) -&gt; x
  ; (if t a ...) -&gt; a
  ; (if nil a b) -&gt; b
  ; (if nil a b c) -&gt; (if b c)&lt;/pre&gt;(Except that the comment mixes up the syntactic specification and the semantic evaluation.)

As a side note, now that we have this definition, it is easy to construct a new language that is just like MzScheme, except for its &lt;code&gt;if&lt;/code&gt; that behaves like the above:&lt;pre&gt;  (module arc-like mzscheme
    (define-syntax if* ...&lt;em&gt;the above definition&lt;/em&gt;...)
    (provide (all-from-except mzscheme if)
             (rename if* if)))&lt;/pre&gt;You can now write code that uses &lt;code&gt;"arc-like.scm"&lt;/code&gt; as its language, using the new &lt;code&gt;if&lt;/code&gt;.  There is no problem in accommodating two languages with two different &lt;code&gt;if&lt;/code&gt;'s: the new form is compiled to the old one, and there is no confusion in which version you use in any module.

Back to the macro issue: as I said above, you run into problems if you want to capture names, right?  For example, if you want to implement Arc's &lt;code&gt;aif&lt;/code&gt;.  The usual &lt;code&gt;syntax-case&lt;/code&gt; solution is to construct an identifier that has the lexical context of the input syntax.  It's easy to abstract over all this &amp;mdash; I posted a &lt;a href="http://www.arclanguage.org/item?id=841"&gt;message&lt;/a&gt; on the Arc forum showing how to define a &lt;a href="http://tmp.barzilay.org/defmac.ss"&gt;defmac&lt;/a&gt; macro that has the simplicity of &lt;code&gt;syntax-rules&lt;/code&gt; with the added convenience of specifying keywords and captured names.  This works for &lt;em&gt;some&lt;/em&gt; cases, but there are still some &lt;a href="http://download.plt-scheme.org/doc/372/html/mzscheme/mzscheme-Z-H-12.html#node_sec_12.2.1.1"&gt;subtle corner cases&lt;/a&gt;.

But there's a better solution in PLT Scheme, one that follows Paul Graham's intuition when he &lt;a href="http://www.arclanguage.org/item?id=2526"&gt;says&lt;/a&gt;:&lt;blockquote&gt;&amp;ldquo;captured symbols are kind of freaky&amp;rdquo;&lt;/blockquote&gt;The basic idea is a change of perspective: instead of (unhygienically) binding individual occurrences of &lt;code&gt;it&lt;/code&gt; whenever &lt;code&gt;aif&lt;/code&gt; is used, you define &lt;code&gt;it&lt;/code&gt; once as a thing in its own right &amp;mdash; a special context-dependant piece of syntax. Outside of an &lt;code&gt;aif&lt;/code&gt; form, &lt;code&gt;it&lt;/code&gt; has no meaning: we simply make it throw a syntax error.  Uses of &lt;code&gt;aif&lt;/code&gt; provide a meaning for &lt;code&gt;it&lt;/code&gt; by locally changing its meaning (its expansion) to something useful: the binding that holds the result of evaluating the condition expression.  (&amp;ldquo;Locally&amp;rdquo; means within a piece of syntax, so the new meaning is valid in a lexical-scope.)

In PLT Scheme, the &amp;ldquo;special context-dependant piece of syntax&amp;rdquo; are &lt;em&gt;syntax parameters&lt;/em&gt;, and you change them locally with &lt;code&gt;syntax-parameterize&lt;/code&gt;.

To continue the above example, here's how we make our &lt;code&gt;if*&lt;/code&gt; anaphoric:
&lt;ul&gt;&lt;li&gt;require the &lt;code&gt;(lib "stxparam.ss" "mzlib")&lt;/code&gt; library,&lt;/li&gt;&lt;li&gt;define &lt;code&gt;it&lt;/code&gt; as a syntax using &lt;code&gt;define-syntax-parameter&lt;/code&gt;, and have it raise an error by default,&lt;/li&gt;&lt;li&gt;bind a temporary variable to the result of evaluating the condition,&lt;/li&gt;&lt;li&gt;wrap the positive branch with &lt;code&gt;syntax-parameterize&lt;/code&gt;, using &lt;code&gt;make-rename-transformer&lt;/code&gt;, which is a convenient way to make a macro that behaves like the new variable.&lt;/li&gt;&lt;/ul&gt;The implementation looks like this:&lt;pre&gt;
  (require (lib "stxparam.ss" "mzlib"))
  (define-syntax-parameter it
    (lambda (stx)
      (raise-syntax-error #f "can only be used inside `if'" stx)))
  (define-syntax if*
    (syntax-rules ()
      [(if*) (void)]
      [(if* X) X]
      [(if* C X more ...)
       (let ([b C])
         (if b
           (syntax-parameterize ([it (make-rename-transformer #'b)]) X)
           (if* more ...)))]))&lt;/pre&gt;The resulting macro does not break hygiene.  For example, &lt;code&gt;(let ([it 3]) (if #t it))&lt;/code&gt; evaluates to &lt;code&gt;3&lt;/code&gt;, because it shadows the global &lt;code&gt;it&lt;/code&gt; that &lt;code&gt;if&lt;/code&gt; changes.  This is a change from a real unhygienic macro &amp;mdash; but that's the whole point: we (the macro author) do not interfere with scopes in the user code.

Note that &lt;code&gt;(if 1 (if 2 it))&lt;/code&gt; still evaluates to &lt;code&gt;2&lt;/code&gt;, because the outer &lt;code&gt;if&lt;/code&gt; does not really bind &lt;code&gt;it&lt;/code&gt; &amp;mdash; it is not captured, just changed locally &amp;mdash; so the inner &lt;code&gt;if&lt;/code&gt; changes it again.  Also, &lt;code&gt;(if #f it it)&lt;/code&gt; raises the usual context error, since our macro changes &lt;code&gt;it&lt;/code&gt; only in the positive branch.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-903780350920969233?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/903780350920969233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=903780350920969233' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/903780350920969233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/903780350920969233'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2008/02/dirty-looking-hygiene.html' title='Dirty Looking Hygiene'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-3376141267131043957</id><published>2008-01-14T15:21:00.001-05:00</published><updated>2008-01-14T15:21:46.731-05:00</updated><title type='text'>A Privacy Flaw, Thwarted</title><content type='html'>&lt;p&gt;
My student Brendan Hickey recently identified the following security
hole.
&lt;/p&gt;

&lt;p&gt;
A university (let's call it Orange University) wants to let its
graduating students vote on their graduation speaker.  They used to do
it by paper; catching up with the times, they now do it on the Web.
&lt;/p&gt;

&lt;p&gt;
They used to have a box into which you could type the name of your
nominee.  But that is surely problematic: people misspell names, you
have to argue about how to count ambiguous votes, someone will vote
for their pet bonobo, etc.  Better (perhaps) to give them the names of
all the students and let them choose.  [Alert: if Orange U adopts a
simple naming scheme for email addresses, a student can immediately
screen-scrape a pretty plum list to sell a spammer.  Brendan and I
noticed this in a femtosecond; I don't know why this didn't occur to
the university.]
&lt;/p&gt;

&lt;p&gt;
Anyway, now you have a Web page where people are going to choose, and
the software that processes the responses must distinguish between
these choices.  You have to associate a key with each student.  You've
already got a key for each candidate: their student ID number.  So you
use that as your key.  Now anyone viewing the page source can
immediately see which student ID number goes with which student name.
So much for confidentiality.
&lt;/p&gt;

&lt;p&gt;
Whoops.
&lt;/p&gt;

&lt;p&gt;
I'd like to point out that Pete Hopkins's
&lt;code&gt;send/suspend/dispatch&lt;/code&gt;, and the improved version of it by
Jay McCarthy, identify and solve just this code structuring problem in
a way that the privacy leak can never occur.  For the most up-to-date
presentation of it, read section 3.2 and section 4 of
&lt;a href="http://www.cs.brown.edu/~sk/Publications/Papers/Published/khmgpf-impl-use-plt-web-server-journal/"&gt;our
paper&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
Maybe Orange U should be using Scheme.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-3376141267131043957?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/3376141267131043957/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=3376141267131043957' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/3376141267131043957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/3376141267131043957'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2008/01/privacy-flaw-thwarted.html' title='A Privacy Flaw, Thwarted'/><author><name>Shriram Krishnamurthi</name><uri>http://www.blogger.com/profile/02956763366608000839</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-103836778351212601</id><published>2007-12-29T15:49:00.000-05:00</published><updated>2007-12-29T15:53:47.607-05:00</updated><title type='text'>The Design of Extended Exercises</title><content type='html'>&lt;p&gt;
One of the highlights of the TeachScheme! method is to create Extended
Exercises.  Several of these pepper &lt;cite&gt;How to Design
Programs&lt;/cite&gt;, and even more have been created since to deal with a
variety of interesting problem scenarios (e.g., illustrating graphics
via t-shirt design, explaining networking by having machines play
roles in a theatrical play, demonstrating communication with foreign
sites by processing data from a microfinance institution, etc).
Through an Extended Exercise a student learns about how computer
science connects to domains, develops practice building programs
incrementally, learns to build earlier assignments that later
assignments can depend on, and so forth.
&lt;/p&gt;

&lt;p&gt;
Here is a preliminary articulation of some principles that I think
govern a good Extended Exercise, with an emphasis on their &amp;ldquo;form
factor&amp;rdquo;.
&lt;/p&gt;

&lt;ul&gt;

&lt;li&gt;
Pick a domain.  Whether the domain looks inward (a computing
activity such as networking) or outward (such as social networking)
doesn't matter.  If it does look inward, try to make it more
applicable through the judicious use of data (the same exercise can
look very dry or very applied depending on what data you choose).  For
instance, our networking exercises is presented in terms of
Shakespeare's &lt;cite&gt;Hamlet&lt;/cite&gt;.
&lt;/li&gt;

&lt;li&gt;
If necessary, write a Teachpack.  A domain almost certainly needs a
Teachpack to reduce the programming burden on students.  For instance,
the microfinance exercise uses a Teachpack to hide the ugly details of
screen-scraping (which in turn need to be constantly updated by a
vigilant maintainer).
&lt;/li&gt;

&lt;li&gt;
Try to provide a non-trivial dataset in the Teachpack.  Good data can
make an assignment more enjoyable&amp;mdash;e.g., our networking example
provides an excerpt from Act 2, Scene 2 of &lt;cite&gt;Hamlet&lt;/cite&gt;
(&amp;ldquo;What a piece of work is man!&amp;rdquo;)&amp;mdash;and in cases where
the exercise depends on connecting to an external site (e.g., the
microfinance example), the data may be essential.
&lt;/li&gt;

&lt;li&gt;
Structure the assignment to have five to eight questions: not much
fewer (too few steps) nor much more (too much to grasp).
&lt;/li&gt;

&lt;li&gt;
Try to decompose the problem using good principles of stepwise
refinment, using your own wisdom in these matters.  By showing
students several such examples, we hope for them to build up an
intuition for the process.  Your decomposition may not be strictly
linear; that's okay.  But it should be progressive.
&lt;/li&gt;

&lt;li&gt;
Perhaps the most important point: At every step, try to have a full,
working application.  That means the Teachpack may need to export
several interfaces, each one taking more parameters and accepting more
functionality than the previous one.  Otherwise the student needs to
have all the parts working before they can understand whether even one
works in context, leading to a frustrating learning experience and
encouraging wanton hacking as they try (and invariably fail) to
quickly get to a working system.
&lt;/li&gt;

&lt;li&gt;
Design interfaces carefully to make judicious use of first-class
functions.  It is inevitable that students will need to provide
functions (not just flat data) to what your Teachpack exports.  Show
them the invocations of your Teachpack in terms of named functions
(that they define).
&lt;/li&gt;

&lt;li&gt;
Try to provide a few extra-credit routes for ambitious students.
Options include letting students peel back even more of the Teachpack,
or adding interesting features.
&lt;/li&gt;

&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-103836778351212601?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/103836778351212601/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=103836778351212601' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/103836778351212601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/103836778351212601'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/12/design-of-extended-exercises.html' title='The Design of Extended Exercises'/><author><name>Shriram Krishnamurthi</name><uri>http://www.blogger.com/profile/02956763366608000839</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-21355758042095400</id><published>2007-12-29T01:00:00.000-05:00</published><updated>2011-11-09T22:52:20.894-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>PLT Scheme v372</title><content type='html'>&lt;div align="left"&gt;PLT Scheme version 372 is now available from
&lt;a href="http://download.plt-scheme.org/"&gt;&lt;span style="font-family:courier new;"&gt;http://download.plt-scheme.org/&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div align="left"&gt;This is mostly a bug-fix release.&lt;/div&gt;&lt;div align="left"&gt;
Changes:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;DrScheme now supports name completion via Ctl-/ (Windows and X) or Cmd-/ (Mac OS X). Completion is sensitive to the current language in DrScheme, but it is not sensitive to lexical bindings.&lt;/li&gt;&lt;li&gt;DrScheme's stepper now supports the "&lt;span style="font-family:courier new;"&gt;check-expect&lt;/span&gt;", "&lt;span style="font-family:courier new;"&gt;check-within&lt;/span&gt;", and "&lt;span style="font-family:courier new;"&gt;check-error&lt;/span&gt;" forms of the &lt;span style="font-family:courier new;"&gt;testing.ss&lt;/span&gt; teachpack.&lt;/li&gt;&lt;li&gt;A number of bug fixes and small improvements for ProfessorJ. The grammar for the current release slightly differs from the one in HtDC.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Feedback Welcome.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-21355758042095400?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://download.plt-scheme.org/' title='PLT Scheme v372'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/21355758042095400/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=21355758042095400' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/21355758042095400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/21355758042095400'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/12/plt-scheme-v372.html' title='PLT Scheme v372'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-1126871850288180624</id><published>2007-12-19T17:11:00.000-05:00</published><updated>2007-12-19T23:16:53.899-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='drscheme'/><title type='text'>Your security hole is my fun hack, or: computing factorial in DrScheme with a click-powered loop.</title><content type='html'>&lt;p&gt;
One of the many changes in v4.0 is to close a security hole in DrScheme. Specifically, DrScheme v371 lets the program in the definitions window get a hold of the editor containing said program and manipulate it programmatically. There are lots of bad things one might do with this fact, like circumventing DrScheme's protections and cause it to crash, or even spontaneously exit.
&lt;/p&gt;

&lt;p&gt;
But, we can do something even more fun. Put the following program into a DrScheme window (in v371) and set the language to the mzscheme/textual language. Change "input" to whatever number you wish to compute the factorial of and then hit the Run button until your program transforms itself into the final result.
&lt;/p&gt;

&lt;pre&gt;
(define input 10)
(require (lib "mred.ss" "mred") (lib "class.ss"))
(let* ([ed (let-syntax ([m (λ (stx) (with-syntax ([x (syntax-source stx)]) #'x))])
             (m))]
       [mth (regexp-match 
             #rx"^; ([0-9]+) ([0-9]+)" 
             (send ed get-text 0 
                   (send ed paragraph-end-position 0)))]
       [lckd (send ed is-locked?)])
  (send ed begin-edit-sequence)
  (send ed lock #f)
  (if mth
      (let ([n (string-&gt;number (list-ref mth 1))]
            [acc (string-&gt;number (list-ref mth 2))])
        (send ed delete 0 (send ed paragraph-end-position 0))
        (if (= n 1)
            (begin (send ed delete 0 (send ed paragraph-end-position 0))
                   (send ed insert (format "~a\n#|" acc) 0)
                   (send ed insert "\n|#" (send ed last-position)))
            (begin (send ed delete 0 (send ed paragraph-end-position 0))
                   (send ed insert (format "; ~a ~a" (- n 1) (* n acc)) 0 0))))
      (send ed insert (format "; ~a 1\n" input) 0))
  (send ed lock lckd)
  (send ed end-edit-sequence))
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-1126871850288180624?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/1126871850288180624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=1126871850288180624' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1126871850288180624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1126871850288180624'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/12/your-security-hole-is-my-fun-hack-or.html' title='Your security hole is my fun hack, or: computing factorial in DrScheme with a click-powered loop.'/><author><name>Robby</name><uri>http://www.blogger.com/profile/08402308775580442837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='13' height='32' src='http://people.cs.uchicago.edu/~robby/portrait-2006.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-1842888151218385802</id><published>2007-11-12T07:53:00.000-05:00</published><updated>2007-11-12T08:46:43.172-05:00</updated><title type='text'>Getting rid of set-car! and set-cdr!</title><content type='html'>&lt;p&gt;&lt;b&gt;Functional is Beautiful&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Scheme is a “mostly functional” language. Although Schemers don’t hesitate to use &lt;tt&gt;set!&lt;/tt&gt; when mutation solves a problem best, Scheme programmers prefer to think functionally. Purely functional programs are easier to test, they make better and more reliable APIs, and our environments, compilers, and run-time systems take advantage of functional style.&lt;/p&gt;

&lt;p&gt;A Schemer’s functional bias is especially strong when writing programs that process and produce lists. The &lt;tt&gt;map&lt;/tt&gt; function, which does both, is a thing of beauty:&lt;/P&gt;
&lt;pre&gt;
  (define (map f l)
   (cond
     [(null? l) '()]
     [else (cons (f (car l)) (map f (cdr l)))]))
&lt;/pre&gt;&lt;p&gt;The &lt;tt&gt;map&lt;/tt&gt; function is most beautiful when the given &lt;tt&gt;f&lt;/tt&gt; is functional. If &lt;tt&gt;f&lt;/tt&gt; has side-effects, the the above implementation over-specifies &lt;tt&gt;map&lt;/tt&gt;, which is traditionally allowed to process the list in any order that it wants (though PLT Scheme guarantees left-to-right order, as above). Arguably, when some other Schemer provides a non-functional &lt;tt&gt;f&lt;/tt&gt;, then it’s their problem; they have to deal with the consequences (which may well be minor compared to some benefits of using mutation).&lt;/p&gt;

&lt;p&gt;The &lt;tt&gt;map&lt;/tt&gt; function might also receive a non-list, but the &lt;tt&gt;map&lt;/tt&gt; implementor can guard against such misuse of &lt;tt&gt;map&lt;/tt&gt; by wrapping it with a check,&lt;/p&gt;

&lt;pre&gt;
  (define (checked-map f l)
    (if (list? l)
        (map f l)
        (error 'map "not a list")))
&lt;/pre&gt;

&lt;p&gt;and then exporting &lt;tt&gt;checked-map&lt;/tt&gt; instead of the raw &lt;tt&gt;map&lt;/tt&gt;. This kind of checking gives nicer error messages, and it helps hide implementation details of &lt;tt&gt;map&lt;/tt&gt;. We could further also imagine that the raw &lt;tt&gt;map&lt;/tt&gt; is compiled without run-time checks on &lt;tt&gt;car&lt;/tt&gt; and &lt;tt&gt;cdr&lt;/tt&gt;.
&lt;/p&gt;

&lt;P&gt;&lt;b&gt;The Problem with Mutable Pairs&lt;/b&gt;&lt;/P&gt;

&lt;p&gt;What if someone calls &lt;tt&gt;checked-map&lt;/tt&gt; like this?:&lt;/P&gt;
&lt;pre&gt;
  (define l (list 1 2 3 4 5))
  (checked-map (lambda (x)
                 (set-cdr! (cddr l) 5))
               l)
&lt;/pre&gt;&lt;p&gt;The &lt;tt&gt;f&lt;/tt&gt; provided to &lt;tt&gt;map&lt;/tt&gt; in this case is not purely functional. Moreover, it uses mutation in a particularly unfortunate way: the&lt;tt&gt; list?&lt;/tt&gt; test in &lt;tt&gt;checked-map&lt;/tt&gt; succeeds, because the argument is&lt;i&gt; initially&lt;/i&gt; a list, and the mutation is ultimately discovered by a call to &lt;tt&gt;cdr&lt;/tt&gt; --- but only if checks haven't been disabled.&lt;/p&gt;

&lt;p&gt;If you’re a Schemer, then unless you’ve seen this before, or unless you thought a bit about the title of this section, then you probably didn't think of the above test case for &lt;tt&gt;map&lt;/tt&gt;. A Schemer’s view of lists is so deeply functional that it's hard to make this particular leap.&lt;/p&gt;

&lt;p&gt;Furthermore, this example is not contrived. If you have either Chez Scheme version 6.1 or a pre-200 MzScheme sitting around, calling &lt;tt&gt;map&lt;/tt&gt; as above leads to a seg fault or an invalid memory access:&lt;/p&gt;

&lt;pre&gt;
  Chez Scheme Version 6.1
  Copyright (c) 1998 Cadence Research Systems

  &gt; (define l (list 1 2 3 4 5))
  &gt; (map (lambda (x) (set-cdr! (cddr l) 5)) l)

  Error: invalid memory reference.
  Some debugging context may have been lost.
&lt;/pre&gt;

&lt;p&gt;The &lt;tt&gt;map&lt;/tt&gt; example illustrates how mutable pairs can break a Schemer’s natural and ingrained model of programming. Of course, if optimizing and providing friendly error messages for &lt;tt&gt;map&lt;/tt&gt; were the only issues with mutable pairs, then it wouldn’t matter; Scheme implementors are smart enough to (eventually) get this right. Unfortunately, the underlying problem is more pervasive.&lt;/p&gt;

&lt;p&gt;In the API for a typical Scheme library, lists can be used for many kinds of input and output. Flags for options might be provided in a list. A function might provide information about the current configuration (e.g., the current items in a GUI list box) in a list. Procedures or methods that deal gracefully with list mutation are few and far between. In most cases, the result of unexpected mutation is merely a bad error message; sometimes, however, unexpected mutation of a list can break the library’s internal invariants. In the worst case, the library whose internal invariants are broken plays some role in a system’s overall security.&lt;/P&gt;

&lt;p&gt;Mutable lists also interfere with the language’s extensibility. The PLT Scheme contract system, for example, offers a way to wrap an exported function with a contract that constrains its input and outputs, which are optionally (in principle) enforced by run-time checks. Higher-order contracts, such as “a list of functions that consume and produce numbers”, require wrappers on sub-pieces, and these wrappers can be installed only by copying the enclosing list. Copying a mutable list changes the semantics of a program, however, whereas contracts are supposed to enforce invariants without otherwise changing the program. Copying an immutable list creates no such problem.&lt;/P&gt;

&lt;p&gt;Finally, mutable lists make the language’s specification messy. The R6RS editors spent considerable energy trying to pin down the exception-raising guarantees of &lt;tt&gt;map&lt;/tt&gt;; the possibility of mutable pairs made it difficult to provide much of a guarantee. The standard says that implementations &lt;span style="font-style: italic;"&gt;should&lt;/span&gt; check that the lists provided to&lt;tt&gt; map&lt;/tt&gt; are the same length, but it’s not worth much to require that check, since an argument’s length as a list can change via mutation to the list’s pairs.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Switching to Immutable Pairs&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;The designers of PLT Scheme long ago recognized the problems of mutable pairs, and we introduced functions like &lt;tt&gt;cons-immutable&lt;/tt&gt; and&lt;tt&gt; list-immutable&lt;/tt&gt; to support programming with immutable lists.  These additions solved some problems --- but only in the cases where we were careful to use immutable lists. The R6RS editors also recognized the problems of mutable pairs, so that &lt;tt&gt;set-car!&lt;/tt&gt; and &lt;tt&gt;set-cdr!&lt;/tt&gt; were banished to their own library --- but programmers are still free to use that library.&lt;/p&gt;

&lt;p&gt;While these are worthwhile steps for many reasons, they do not solve the underlying problem. Library implementors who deal in lists must still either set up elaborate guards against mutation, pretend that the problem doesn't matter, or require the use of a special immutable-list datatype that is incompatible with libraries whose authors set up elaborate guards or ignore the problem.&lt;/p&gt;

&lt;p&gt;Why all this hassle? If most Scheme code really does use and expect pairs in a functional way, can't we just switch to immutable pair? Most Scheme code will still work, untold security holes will have been closed, specifications will become instantly tighter, and language extensions like contracts will work better.&lt;/p&gt;

&lt;p&gt;Schemers have been reluctant to make this leap, because it has never been clear just how much code relies on mutable pairs. We don’t know how much the switch will cost in porting time and long-term incompatibility, and we don’t really know how much we will gain. We won't know until we try it.&lt;/P&gt;

&lt;p&gt;For PLT Scheme v4.0, we’re going to try it. In our main dialects of Scheme (such as the &lt;tt&gt;mzscheme&lt;/tt&gt; language), &lt;tt&gt;cons&lt;/tt&gt; will create immutable pairs, and &lt;tt&gt;pair?&lt;/tt&gt; and &lt;tt&gt;list?&lt;/tt&gt; will recognize only immutable pairs and lists. The &lt;tt&gt;set-car!&lt;/tt&gt; and &lt;tt&gt;set-cdr&lt;/tt&gt; procedures will not exist. A new set of procedure &lt;tt&gt;mcons&lt;/tt&gt;, &lt;tt&gt;mcar&lt;/tt&gt;, &lt;tt&gt;mcdr&lt;/tt&gt;, &lt;tt&gt;set-mcar!&lt;/tt&gt;, and &lt;tt&gt;set-mcdr!&lt;/tt&gt; will support mutable pairs. (A related v4.0 change is that&lt;tt&gt; define-struct&lt;/tt&gt; by default creates immutable structure types.)&lt;/p&gt;

&lt;p&gt;Of course, PLT Scheme v4.0 will support an R5RS language where &lt;span style="font-family:monospace;"&gt;&lt;/span&gt;&lt;tt&gt;cons&lt;/tt&gt; is &lt;tt&gt;mcons&lt;/tt&gt;, and so on, so many old programs can still run easily in the new version. The difference is that interoperability between R5RS libraries and PLT Scheme libraries will be less direct than before.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Experience So Far&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;PLT Scheme v3.99.0.2 exists already in a branch of our SVN repository, and it will soon move to the SVN trunk. That is, we have already ported at least a half million lines of Scheme code to a dialect without &lt;tt&gt;set-car!&lt;/tt&gt; and &lt;tt&gt;set-cdr!&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;The conversion took about eight hours. Obviously, relatively little code had to change. The following are the typical porting scenarios:&lt;p&gt;

&lt;ul&gt;&lt;li&gt;&lt;p&gt;The &lt;tt&gt;reverse!&lt;/tt&gt; and &lt;tt&gt;append!&lt;/tt&gt; functions were frequently used for “linear updates” by performance-conscious implementors. As our underlying Scheme implementation has improved, however, the performance benefits of these functions has become less. All uses could be replaced with &lt;tt&gt;reverse&lt;/tt&gt; and &lt;tt&gt;append&lt;/tt&gt;.&lt;/p&gt;

&lt;/li&gt;&lt;li&gt;&lt;p&gt;The &lt;tt&gt;set-cdr!&lt;/tt&gt; operation was often used to implement an internal queue. Such internal queues were easily changed to use &lt;tt&gt;mcons&lt;/tt&gt;,&lt;tt&gt; mcar&lt;/tt&gt;, &lt;tt&gt;mcdr&lt;/tt&gt;, and &lt;tt&gt;set-mcdr!&lt;/tt&gt;.&lt;/p&gt;

&lt;/li&gt;&lt;li&gt;&lt;p&gt;An association-list mapping was sometimes updated with &lt;tt&gt;set-cdr!&lt;/tt&gt; when a mapping was present, otherwise the list was extended. Since the extension case was supported, it was easy to just update the list functionally. (The relevant lists were short; if the lists were long, the right change would be to use a hash table instead of a list.)&lt;/p&gt;

&lt;/li&gt;&lt;li&gt; &lt;p&gt;A pair was sometime used for an updatable mapping where a distinct structure type is better. The quick solution was to throw in a mutable box in place of the value.&lt;/p&gt;
&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;The PLT Scheme code might be better positioned for the switch than arbitrary Scheme code. Most of it was written by a handful of people who understood the problems of mutable pairs, and who might therefore shy away from them. However, the PLT Scheme code base includes a lot of code that was not written specifically for PLT Scheme, including Slatex, Tex2page, and many SRFI reference implementations. With the exception of SRFI-9, which generalizes &lt;tt&gt;set!&lt;/tt&gt; to work with pairs, the SRFI implementations were remarkably trouble free. (Thanks to Olin Shivers for making mutation optional in the “linear update” functions like &lt;tt&gt;reverse!&lt;/tt&gt; from SRFIs 1 and 32.)&lt;/P&gt;

&lt;p&gt;In addition, we looked at a number of standard Scheme benchmarks, which can be found here:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://svn.plt-scheme.org/plt/trunk/collects/tests/mzscheme/benchmarks/common/"&gt;   http://svn.plt-scheme.org/plt/trunk/collects/tests/mzscheme/benchmarks/common/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Of the 28 benchmarks, eight of them mutate pairs. Four of those are trivially converted to functional programs, along the lines of the scenarios above. One, &lt;tt&gt;destruct&lt;/tt&gt;, is designed specifically to test mutation performance, so it makes no sense to port. Another, &lt;tt&gt;sort1&lt;/tt&gt;, is a sorting algorithm that inherently relies on mutation; a functional sort is obviously possible, but that would be a different benchmark. The &lt;tt&gt;conform&lt;/tt&gt; benchmark uses mutable pairs for tables in a relatively non-local way; as a modern Scheme program, it would probably be written
with structures, but it’s not trivial to port. The &lt;tt&gt;peval&lt;/tt&gt; benchmark uses pairs to represent Scheme programs, and it partially evaluates the program by mutating it, so it is not trivial to port. To summarize, out of 28 old, traditional benchmark programs, only two represent interesting programs that are not easily adapted to immutable pairs. (They run in PLT Scheme’s R5RS language, of course.)
&lt;/p&gt;

&lt;p&gt;Finally, we selected a useful third-party library that is not included with PLT Scheme. We checked the generic SSAX implementation (not the PLT Scheme version), and we found a couple of uses of &lt;tt&gt;set-car!&lt;/tt&gt; and &lt;tt&gt;set-cdr!&lt;/tt&gt;. Again, they fall into the above queue and association-list categories that are easily and locally converted.&lt;/p&gt;

&lt;p&gt;Meanwhile, as we start to use v3.99 to run scripts in our day-to-day work, immutable pairs have so far created no difficulty at all.  So far, then, our optimism in trying immutable pairs seems to be justified; it just might work.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;But It&lt;/b&gt;&lt;span style="font-weight: bold;"&gt;’&lt;/span&gt;&lt;b&gt;s Lisp Tradition!&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;A typical response to news of the demise of mutable pairs is that it will create lot of trouble, because mutable pairs are Scheme tradition, and surely lots of useful old code exploits them in lots of places.&lt;/p&gt;

&lt;p&gt;We’re eager to hear whether anyone has such code. Our initial hypothesis is that practically all old code falls into one of two categories:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt; &lt;p&gt;The code is easily ported to immutable pairs, along the same lines as above (i.e., local queues and small association lists).&lt;/p&gt;

&lt;/li&gt;&lt;li&gt; &lt;p&gt;The code so old and generic that it can be run as an R5RS program.  It won’t call into the large PLT Scheme set of libraries that will expect immutable pairs, and it can easily be used as a library with wrappers that convert mutable pairs back and forth with immutable pairs.&lt;/p&gt;
&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;Frankly, we’re not so eager to hear opinions based on guesswork about existing code and how it might get used. Download v3.99 from SVN or as a nightly build when it becomes available; let us know your guesses about how running your old code would go, but then let us know what&lt;i&gt; actually&lt;/i&gt; happens.&lt;/p&gt;

&lt;p&gt;The immutable-pairs plan for v4.0 is not set in stone, but we won’t make the decision based on guesswork. More libraries (other than R5RS) to aid compatibility may be useful, but so far we don’t have a tangible need for them. In any case, we’ll revert to mutable pairs only if significant experience with the pre-release version demonstrates that it really won’t work.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-1842888151218385802?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/1842888151218385802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=1842888151218385802' title='32 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1842888151218385802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1842888151218385802'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/11/getting-rid-of-set-car-and-set-cdr.html' title='Getting rid of set-car! and set-cdr!'/><author><name>Matthew Flatt</name><uri>http://www.blogger.com/profile/03369511886823036667</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>32</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-8762291102712481013</id><published>2007-09-14T17:56:00.000-04:00</published><updated>2007-09-14T18:03:19.654-04:00</updated><title type='text'>Don't say "abstract" (instead say "general")</title><content type='html'>&lt;p&gt;The word "abstract" is common in computer science.  An abstract thing is one where some part of the whole is unspecified.  For instance, the expression "3*x + 3" is an abstraction of the expression "3*4+3", because the "x" is unspecified. Likewise, a function is an abstraction over some set of values, supplied when the function is called.&lt;/p&gt;

&lt;p&gt;The word "general" is not at all common in computer science.  In non-computer-science use, the word "general" is used to describe things that may be applied to more than one thing or situation.  For instance, a "more general solution" is one that applies not just to the problem at hand, but instead to a larger set of problems.&lt;/p&gt;

&lt;p&gt;From a computer science perspective, things that are abstract are also general.  Things that are general are also abstract.  Substituting the word "general" for the word "abstract" would not be a terrible hurdle.&lt;/p&gt;

&lt;p&gt;From a non-computer-science perspective, however, "general" and "abstract" have very different implications.  Something that is general is better: it is more useful, it applies more frequently.  Something that is abstract, though, is worse: it is lacking detail, it is non-concrete.&lt;/p&gt;

&lt;p&gt;This is one difference--the major difference?--between computer science (and of course mathematics) and the real world: &lt;i&gt;the abstract is no less concrete&lt;/i&gt;. We can abstract over expressions using functions, and we can even abstract over syntactic things, using hygienic macros.  The result of such abstraction is a perfectly well-defined element in our universe of expressions.&lt;/p&gt;

&lt;p&gt;In computer science, then, the pejorative sense of the word "abstract" is misleading, and the use of the terms "abstract" and "abstraction" merely provides ammunition for those who wish that we could all still be writing assembly language.&lt;/p&gt;

&lt;p&gt;I suggest instead the use of the word "general."&lt;/p&gt;


John "purveyor of barbarous neologisms" Clements&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-8762291102712481013?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/8762291102712481013/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=8762291102712481013' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8762291102712481013'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8762291102712481013'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/09/dont-say-abstract-instead-say-general.html' title='Don&apos;t say &quot;abstract&quot; (instead say &quot;general&quot;)'/><author><name>John Clements</name><uri>http://www.blogger.com/profile/10401643794201938443</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-1723323722672477302</id><published>2007-09-09T20:54:00.001-04:00</published><updated>2007-12-19T23:17:25.168-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='drscheme'/><title type='text'>Completions in DrScheme (finally)</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_gJUvnpacURg/RuSWwE8Za5I/AAAAAAAAAA8/KMW42c1uU2g/s1600-h/Picture+2.png"&gt;
&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_gJUvnpacURg/RuSWwE8Za5I/AAAAAAAAAA8/KMW42c1uU2g/s400/Picture+2.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5108373630049938322" /&gt;&lt;/a&gt;
&lt;p&gt;
DrScheme now supports a language- sensitive (but not lexical- scope sensitive) completion feature. Type &amp;lt;menukey&amp;gt;-/ and see what names are available to finish off the word you're typing. 
&lt;/p&gt;
&lt;p&gt;
Thanks to &lt;a href="http://www.cs.uchicago.edu/~jacobm/"&gt;Jacob&lt;/a&gt; (and do follow that link; we all need a little more love in our lives) and &lt;a href="http://turingcompletewasteoftime.blogspot.com/"&gt;Mike&lt;/a&gt; for taking the initiative to actually implement what is probably the most requested feature in DrScheme at the moment.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-1723323722672477302?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/1723323722672477302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=1723323722672477302' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1723323722672477302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1723323722672477302'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/09/completions-in-drscheme-finally.html' title='Completions in DrScheme (finally)'/><author><name>Robby</name><uri>http://www.blogger.com/profile/08402308775580442837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='13' height='32' src='http://people.cs.uchicago.edu/~robby/portrait-2006.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_gJUvnpacURg/RuSWwE8Za5I/AAAAAAAAAA8/KMW42c1uU2g/s72-c/Picture+2.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-2026851843466892876</id><published>2007-09-06T10:30:00.000-04:00</published><updated>2007-09-08T08:38:05.326-04:00</updated><title type='text'>How many occurrences of car in the PLT source code?</title><content type='html'>Lets play a guessing game. See who can guess:
&lt;ul&gt;
&lt;li&gt; How many occurrences of the identifier 'car' there are in the PLT tree (when using 'read' and just counting the symbols that come out)? &lt;/li&gt;
&lt;li&gt; Where does 'car' rank on the list of the most commonly used identifiers?
&lt;/li&gt;
&lt;li&gt; What is the most common identifier, and how many occurrences of it are there?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
UPDATE: The two files &lt;tt&gt;raw-hattori&lt;/tt&gt; and &lt;tt&gt;raw-kajitani.ss&lt;/tt&gt; are generated files containing solutions to &lt;a href="http://en.wikipedia.org/wiki/Nonogram"&gt;Paint by Numbers&lt;/a&gt; problems and about 30,000 occurrences of &lt;tt&gt;x&lt;/tt&gt; and &lt;tt&gt;o&lt;/tt&gt;. Discounting them, this is the list of the top ten identifiers and the number of occurrences:

&lt;pre&gt;
((define 25294)
 (quote 24101)
 (lambda 18883)
 (let 14796)
 (send 14349)
 (x 11877)
 (if 11118)
 (... 8474)
 (car 7610)
 (syntax 6537))
&lt;/pre&gt;

The identifier &lt;tt&gt;cdr&lt;/tt&gt; ranks 21st with 5,259 occurrences, &lt;tt&gt;let*&lt;/tt&gt; has 3,066 which, when combined with &lt;tt&gt;let&lt;/tt&gt; comes out at 17,862, still not enough to pass &lt;tt&gt;lambda&lt;/tt&gt;. Speaking of combining, &lt;tt&gt;λ&lt;/tt&gt; has 2,271 occurrences, which is also not enough to move &lt;tt&gt;lambda&lt;/tt&gt;. Finally &lt;tt&gt;map&lt;/tt&gt; comes in 32nd with 3,853 occurrences and &lt;tt&gt;foldl&lt;/tt&gt; beats out &lt;tt&gt;foldr&lt;/tt&gt; (1168th place with 75 occurrences vs 1451st place with 58 occurrences).

&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-2026851843466892876?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/2026851843466892876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=2026851843466892876' title='17 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2026851843466892876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2026851843466892876'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/09/how-many-occurrences-of-car-in-plt.html' title='How many occurrences of car in the PLT source code?'/><author><name>Robby</name><uri>http://www.blogger.com/profile/08402308775580442837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='13' height='32' src='http://people.cs.uchicago.edu/~robby/portrait-2006.jpg'/></author><thr:total>17</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-8001080601289810210</id><published>2007-09-03T18:26:00.001-04:00</published><updated>2007-12-19T23:17:25.168-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='drscheme'/><title type='text'>Birthday Easter Eggs in DrScheme</title><content type='html'>&lt;p&gt;
DrScheme has five birthday easter eggs in it, one for each of the main contributers to the PLT Scheme infrastructure (&lt;a href="http://www.ccs.neu.edu/%7Ematthias/"&gt;Matthias&lt;/a&gt;, &lt;a href="http://www.cs.utah.edu/%7Emflatt/"&gt;Matthew&lt;/a&gt;, &lt;a href="http://www.barzilay.org/"&gt;Eli&lt;/a&gt;, &lt;a href="http://www.cs.brown.edu/%7Esk/"&gt;Shriram&lt;/a&gt;, and &lt;a href="http://www.cs.uchicago.edu/%7Erobby/"&gt;me&lt;/a&gt;). I put four of them in there, and mostly concentrated on making them fun. Matthew added mine and the best part of that one is figuring out on earth it shows up (it is quite tricky to find the code that actually makes that one appear).
&lt;/p&gt;

&lt;p&gt;
I don't want to ruin the fun of searching for the Easter Eggs yourself, but just to get you started, do have a look at &lt;a href="http://svn.plt-scheme.org/plt/trunk/collects/framework/private/bday.ss"&gt;&lt;tt&gt;plt/collects/framework/private/bday.ss&lt;/tt&gt; &lt;/a&gt;
for Matthias, Matthew, Shriram, and Eli's birthdays. Mine is July 2nd.&lt;/p&gt;

&lt;p&gt;
Happy Hunting!
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-8001080601289810210?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/8001080601289810210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=8001080601289810210' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8001080601289810210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8001080601289810210'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/09/birthday-easter-eggs-in-drscheme.html' title='Birthday Easter Eggs in DrScheme'/><author><name>Robby</name><uri>http://www.blogger.com/profile/08402308775580442837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='13' height='32' src='http://people.cs.uchicago.edu/~robby/portrait-2006.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-5223454205316278555</id><published>2007-08-22T21:54:00.001-04:00</published><updated>2007-08-23T19:51:41.051-04:00</updated><title type='text'>New Debugger Features</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_K_e8C0ioWW4/Rs4dcbbe8ZI/AAAAAAAAAAM/SFyArWI5JrA/s1600-h/multi-debug.png"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://bp3.blogger.com/_K_e8C0ioWW4/Rs4dcbbe8ZI/AAAAAAAAAAM/SFyArWI5JrA/s400/multi-debug.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5102047802093924754" /&gt;&lt;/a&gt;
&lt;p&gt;
As Eli mentioned, v371 introduces support for debugging several files at a time, as well as new buttons for stepping &lt;span style="font-style: italic;"&gt;Over&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;Out&lt;/span&gt; of expressions in the debugger.
&lt;/p&gt;

&lt;p&gt;
Debugging across multiple files is easy.  Start by opening the "main" file that you want to debug and all of the files it requires (directly or indirectly) that you want to debug along with it.  Then click Debug in the main file's frame.  For example, if I wanted to see what the FrTime dataflow engine (in &lt;span style="font-family:courier new;"&gt;frp-core.ss&lt;/span&gt;) does when a particular program (say &lt;span style="font-family:courier new;"&gt;demo-module.ss&lt;/span&gt;) runs, I would open these two files and click Debug in the frame for &lt;span style="font-family:courier new;"&gt;demo-module.ss&lt;/span&gt;.
&lt;/p&gt;

&lt;p&gt;
As each required file loads, DrScheme offers the option of debugging it.  If you choose "yes", then the file is included in the debugging session, so you can set breakpoints and step into it.  (Note that this will make the code in the file run more slowly, and single-stepping at calls to its functions will bring you into it.)   A file can only participate in one debugging session at a time, so if you're already debugging it with some other program, DrScheme will tell you so (instead of asking whether to debug it).   For best results, all of the files you debug should be modules.  Once a file is included in the debugging session, you can set breakpoints and step into it as if you were debugging it by itself.
&lt;/p&gt;

&lt;p&gt;
As soon as you can debug programs that span several files, it's particularly valuable to be able to do more than set breakpoints and single-step.  This is the motivation for the new &lt;span style="font-style: italic;"&gt;Over&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;Out&lt;/span&gt; buttons, which are also quite simple.  If the execution marker is at the start of an expression that's not in tail position, then you can step over the entire expression, which is equivalent to setting a one-shot breakpoint at the end of the expression and continuing.  (If you've set breakpoints inside the expression, or inside any functions it calls, then execution may suspend before reaching the end.)  Likewise, if execution is suspended and the current expression is evaluating within a debugging-enabled context, then you can step out to the innermost such context.  This would be difficult to simulate by hand, since you'd need to keep track of recent callers.
&lt;/p&gt;

&lt;p&gt;
At any given point, either or both of the &lt;span style="font-style: italic;"&gt;Over&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;Out&lt;/span&gt; buttons may be disabled, but over the course of a session they can eliminate a lot of tedium.
&lt;/p&gt;

&lt;p&gt;
The screenshot above shows a session debugging &lt;span style="font-family:courier new;"&gt;frp-core.ss&lt;/span&gt; as used by &lt;span style="font-family:courier new;"&gt;demo-module.ss&lt;/span&gt;.  Execution is suspended on a right paren, so stepping &lt;span style="font-style: italic;"&gt;Over&lt;/span&gt; is disabled, but we see the expression's value at the upper left, we've moused over &lt;span style="font-style: italic;"&gt;b&lt;/span&gt; to see its value at the upper right, and it's possible to step &lt;span style="font-style: italic;"&gt;Out&lt;/span&gt;.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-5223454205316278555?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/5223454205316278555/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=5223454205316278555' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/5223454205316278555'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/5223454205316278555'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/08/new-debugger-features.html' title='New Debugger Features'/><author><name>Greg Cooper</name><uri>http://www.blogger.com/profile/09434692258819430131</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_K_e8C0ioWW4/Rs4dcbbe8ZI/AAAAAAAAAAM/SFyArWI5JrA/s72-c/multi-debug.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-6735564762000887924</id><published>2007-08-18T04:00:00.000-04:00</published><updated>2011-11-09T22:52:20.951-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>PLT Scheme v371</title><content type='html'>PLT Scheme version 371 is now available from

  &lt;a href="http://download.plt-scheme.org/"&gt;http://download.plt-scheme.org/&lt;/a&gt;

This is mostly a bug-fix release.

Changes:
&lt;ul&gt;&lt;li&gt;The debugger now works across multiple files and supports "step over" and "step out" operations.&lt;/li&gt;&lt;li&gt;HtDP teachpacks: the world.ss teachpack now exports two add-line functions: one from image.ss and one for adding lines to scenes.&lt;/li&gt;&lt;li&gt;ProfessorJ now includes a language level between Intermediate and Advanced, Intermediate + access, that includes all of Intermediate and introduces access modifiers and overloading.  The language manuals contain the complete details.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Feedback Welcome.&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-6735564762000887924?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://download.plt-scheme.org/drscheme/' title='PLT Scheme v371'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/6735564762000887924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=6735564762000887924' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/6735564762000887924'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/6735564762000887924'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/08/plt-scheme-v371.html' title='PLT Scheme v371'/><author><name>Eli Barzilay</name><uri>http://www.blogger.com/profile/08165322672792335619</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='http://4.bp.blogspot.com/_lx1aK_XwT-o/SxSPoMzJgLI/AAAAAAAAAA8/v5ASXddGsSc/s1600-R/eli-small.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-3907084013741018564</id><published>2007-08-07T20:41:00.001-04:00</published><updated>2007-08-07T21:34:48.798-04:00</updated><title type='text'>PLT Modules and Separate Compilation</title><content type='html'>&lt;p&gt;
For my summer job this year, I'm programming in Common Lisp; this is the
first time I've used the language for anything more than toy examples.  The
experience has given me new appreciation for the PLT module system and how
it enables separate compilation.
&lt;/p&gt;

&lt;p&gt;
Lisp has a package system, of course, but it's not the same thing.  It's
primarily a tool to make sure that the symbols in one part of the program
don't collide with the symbols in another part (unless you ask them to).
Packages aren't about abstraction: while you can specify which symbols are
exported from the package and which aren't, that's just a suggestion that's
not enforced by the language.
&lt;/p&gt;

&lt;p&gt;
(You'll notice, by the way, that I used the word "symbol" and not
"identifier," which is the more common term in the study of programming
languages, in the previous paragraph.  That's deliberate: the Lisp package
system works on symbols, not identifiers, so it also affects quoted,
literal symbols.  In my experience, this is sometimes helpful, sometimes a
real pain, and usually completely unexpected.  But that's a topic for
another post.)
&lt;/p&gt;

&lt;p&gt;
Also, there's no real relationship between Lisp packages and files.  One
package can be spread across multiple files, and one file can contain code
in several different packages.
&lt;/p&gt;

&lt;p&gt;
All this means that separate compilation in Lisp is a real problem.  There
is a system, ASDF, that attempts to address this need.  (For more details,
consult &lt;a href="http://www.cliki.net/asdf"&gt;the closest thing to a
homepage&lt;/a&gt; that I could find for ASDF.)  I'm no expert on ASDF, but
essentially the programmer specifies  the dependencies between source
files, in a set of files that exist parallel to the Lisp source.  (ASDF
does support grouping source files into larger chunks and specifying
dependencies between those chunks, but as far as I can tell that's largely
a convenience thing.)
&lt;/p&gt;

&lt;p&gt;
The key thing for separate compilation, of course, is the dependencies.
With ASDF, the programmer specifies those manually, and then ASDF basically
does a topological sort such that if file &lt;span style="font-style: italic;"&gt;a&lt;/span&gt; depends on file &lt;span style="font-style: italic;"&gt;b&lt;/span&gt;, then ASDF ensures that &lt;span style="font-style: italic;"&gt;a&lt;/span&gt; is compiled and loaded before &lt;span style="font-style: italic;"&gt;b&lt;/span&gt; is compiled, and again before B is loaded.  (This should start sounding a little familiar to folks who've worked in the area where PLT's modules and macros intersect.)&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:georgia;"&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;

&lt;p&gt;
So far, so good.  Unfortunately, there are a couple of problems with this
setup.  First, the dependencies between files are specified &lt;span style="font-style: italic;"&gt;outside&lt;/span&gt; the language.  This means that,
if you happen to forget one, the results are not well-defined.  If ASDF
happens to choose an order that's consistent with the dependency you left
out, everything will just work, and you won't have any indication that
there's a problem.  If, however, it doesn't, then you'll get random
"undefined function" and "undefined symbol" errors---if you're lucky (at
least in SBCL, the implementation of Common Lisp that I use at my job).  In
PLT, by contrast, inter-module dependencies are part of the language, so
the compiler will &lt;span style="font-style: italic;"&gt;always&lt;/span&gt; give you
an undefined-identifier error when it tries to compile a module in which
you've forgotten a &lt;span style="font-family:courier new;"&gt;require&lt;span style="font-family:georgia;"&gt; form.  Big win, in my opinion (although we
could argue about whether this should be an error or a warning, and whether
the compiler should report lots of errors or just one before giving up
completely).
&lt;/p&gt;

&lt;p&gt;
Second, because ASDF lives outside the compiler, it can't be very smart
about how macros affect separate compilation.  I don't fully understand
this, perhaps because the folks who've been mentoring me at my job haven't
thought it worth the time to explain it to me fully.  But it appears that,
if you change a macro that's used in other files, or change a function
that's called by a macro &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="font-family:georgia;"&gt;at expansion time, you have to do
the effect of a &lt;span style="font-family:courier new;"&gt;make clean&lt;span style="font-family:georgia;"&gt; in a distressingly large number of cases.
This is a real problem when you've got a large source base (~200K LOC, I
think) and you're trying to speed up builds, as we are, and it's &lt;span style="font-style: italic;"&gt;especially&lt;/span&gt; problematic if you're trying
to run unrelated parts of the build in parallel.
&lt;/p&gt;

&lt;p&gt;
I've certainly griped about the complexity of the interaction between PLT's
modules and macros in the past.  But after this summer, I have to say it's
awfully nice to have a module system that Just Works for separate
compilation.  Nicely done, Matthew.
&lt;/p&gt;

&lt;p&gt;
(I've pointed the folks at work at Matthew's &lt;a href="http://www.cs.utah.edu/plt/publications/macromod.pdf"&gt;ICFP 02 paper&lt;/a&gt;, but as that technique requires a lot of support from the compiler, and we don't have the resources to add the necessary support to SBCL ourselves, I don't know that it'll be more than a "wouldn't it be nice if we could do that?")
&lt;/p&gt;

&lt;p&gt;
(Answer to rhetorical question in preceding paragraph: Yes.  Yes it would.) &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-3907084013741018564?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/3907084013741018564/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=3907084013741018564' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/3907084013741018564'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/3907084013741018564'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/08/plt-modules-and-separate-compilation.html' title='PLT Modules and Separate Compilation'/><author><name>Richard Cobbe</name><uri>http://www.blogger.com/profile/14142695225678191312</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-1834491843674778394</id><published>2007-08-06T11:21:00.000-04:00</published><updated>2007-08-06T11:32:23.239-04:00</updated><title type='text'>macros and hygiene, resumed</title><content type='html'>The Friday entry demonstrates how to break hygiene for a macro that defines a generator. Ryan Culpepper, the local macrologist, reminded me that expanding into this macro goes wrong in the syntax-case world: 

&lt;div class="scheme"&gt;&lt;pre&gt;(&lt;span class="keyword"&gt;define-syntax&lt;/span&gt; &lt;span class="variable"&gt;define-that-expands-into-define/y&lt;/span&gt; 
  (&lt;span class="keyword"&gt;syntax-rules&lt;/span&gt; ()
    ((&lt;span class="variable"&gt;_&lt;/span&gt; (&lt;span class="variable"&gt;name&lt;/span&gt; &lt;span class="variable"&gt;arg&lt;/span&gt; ...) &lt;span class="variable"&gt;body&lt;/span&gt; ...) 
     (&lt;span class="variable"&gt;define/y&lt;/span&gt; (&lt;span class="variable"&gt;name&lt;/span&gt; &lt;span class="variable"&gt;arg&lt;/span&gt; ...) &lt;span class="variable"&gt;body&lt;/span&gt; ...))))

(&lt;span class="variable"&gt;define-that-expands-into-define/y&lt;/span&gt; (&lt;span class="variable"&gt;bar&lt;/span&gt;)
  (&lt;span class="variable"&gt;yield&lt;/span&gt; &lt;span class="selfeval"&gt;1&lt;/span&gt;)
  (&lt;span class="variable"&gt;yield&lt;/span&gt; &lt;span class="selfeval"&gt;2&lt;/span&gt;)
  &lt;span class="keyword"&gt;'&lt;/span&gt;&lt;span class="variable"&gt;finished&lt;/span&gt;)&lt;/pre&gt;&lt;/div&gt;

Run this in Pretty Big [DrScheme] and you get a strange note concerning MrEd's yield or run it in MzScheme [Textual] and you get an error message about 'yield' being unbound. 

What gives? The 'stx' of &lt;code&gt;datum-&gt;syntax-object&lt;/code&gt; is the syntactic context of the new macro but it doesn't bind yield; it just uses it. So the definition of &lt;code&gt;yield&lt;/code&gt; in &lt;code&gt;define/y&lt;/code&gt; must be a different one according to the hygiene standards. Ergo yield is free at the top-leve [MzScheme] or bound to the yield import from MrEd [Pretty Big]. 

;; --- 

How can we try to fix this? The explanation suggests we use a different macro definition for &lt;code&gt;define/y&lt;/code&gt;, one that uses a context that is guaranteed from the body of an instance of &lt;code&gt;define/y&lt;/code&gt;: 

&lt;div class="scheme"&gt;&lt;pre&gt;(&lt;span class="keyword"&gt;require&lt;/span&gt; (&lt;span class="variable"&gt;lib&lt;/span&gt; &lt;span class="selfeval"&gt;"control.ss"&lt;/span&gt;))

(&lt;span class="keyword"&gt;define-syntax&lt;/span&gt; (&lt;span class="variable"&gt;define/y&lt;/span&gt; &lt;span class="variable"&gt;stx&lt;/span&gt;)
  (&lt;span class="keyword"&gt;syntax-case&lt;/span&gt; &lt;span class="variable"&gt;stx&lt;/span&gt; ()
    [(&lt;span class="variable"&gt;_&lt;/span&gt; (&lt;span class="variable"&gt;name&lt;/span&gt; &lt;span class="variable"&gt;arg&lt;/span&gt; ...) &lt;span class="variable"&gt;body0&lt;/span&gt; &lt;span class="variable"&gt;body&lt;/span&gt; ...)
     (&lt;span class="keyword"&gt;with-syntax&lt;/span&gt; 
         ((&lt;span class="variable"&gt;yield-name&lt;/span&gt; 
           (&lt;span class="builtin"&gt;datum-&amp;gt;syntax-object&lt;/span&gt; (&lt;span class="keyword"&gt;syntax&lt;/span&gt; &lt;span class="variable"&gt;body0&lt;/span&gt;) &lt;span class="keyword"&gt;'&lt;/span&gt;&lt;span class="variable"&gt;yield&lt;/span&gt;)))
       (&lt;span class="keyword"&gt;syntax&lt;/span&gt;
        (&lt;span class="keyword"&gt;define&lt;/span&gt; (&lt;span class="variable"&gt;name&lt;/span&gt; &lt;span class="variable"&gt;arg&lt;/span&gt; ...)
          (&lt;span class="keyword"&gt;define&lt;/span&gt; (&lt;span class="variable"&gt;yield-name&lt;/span&gt; &lt;span class="variable"&gt;x&lt;/span&gt;)
            (&lt;span class="variable"&gt;control&lt;/span&gt; &lt;span class="variable"&gt;resume-here&lt;/span&gt;
             (&lt;span class="keyword"&gt;set!&lt;/span&gt; &lt;span class="variable"&gt;name&lt;/span&gt; 
                   (&lt;span class="keyword"&gt;lambda&lt;/span&gt; ()
                     (&lt;span class="variable"&gt;prompt&lt;/span&gt; (&lt;span class="variable"&gt;resume-here&lt;/span&gt; &lt;span class="keyword"&gt;'&lt;/span&gt;&lt;span class="variable"&gt;dummy&lt;/span&gt;))))
             &lt;span class="variable"&gt;x&lt;/span&gt;))
          (&lt;span class="variable"&gt;prompt&lt;/span&gt; &lt;span class="variable"&gt;body0&lt;/span&gt; &lt;span class="variable"&gt;body&lt;/span&gt; ...))))]))

(&lt;span class="keyword"&gt;define-syntax&lt;/span&gt; &lt;span class="variable"&gt;define-that-expands-into-define/y&lt;/span&gt; 
  (&lt;span class="keyword"&gt;syntax-rules&lt;/span&gt; ()
    ((&lt;span class="variable"&gt;_&lt;/span&gt; (&lt;span class="variable"&gt;name&lt;/span&gt; &lt;span class="variable"&gt;arg&lt;/span&gt; ...) &lt;span class="variable"&gt;body&lt;/span&gt; ...) 
     (&lt;span class="variable"&gt;define/y&lt;/span&gt; (&lt;span class="variable"&gt;name&lt;/span&gt; &lt;span class="variable"&gt;arg&lt;/span&gt; ...) &lt;span class="variable"&gt;body&lt;/span&gt; ...))))

&lt;span class="comment"&gt;;; --- try it out ---
&lt;/span&gt;
(&lt;span class="variable"&gt;define-that-expands-into-define/y&lt;/span&gt; (&lt;span class="variable"&gt;bar&lt;/span&gt;)
  (&lt;span class="variable"&gt;yield&lt;/span&gt; &lt;span class="selfeval"&gt;1&lt;/span&gt;)
  (&lt;span class="variable"&gt;yield&lt;/span&gt; &lt;span class="selfeval"&gt;2&lt;/span&gt;)
  &lt;span class="keyword"&gt;'&lt;/span&gt;&lt;span class="variable"&gt;finished&lt;/span&gt;)

(&lt;span class="builtin"&gt;list&lt;/span&gt; (&lt;span class="variable"&gt;bar&lt;/span&gt;) (&lt;span class="variable"&gt;bar&lt;/span&gt;) (&lt;span class="variable"&gt;bar&lt;/span&gt;) (&lt;span class="variable"&gt;bar&lt;/span&gt;))
&lt;/pre&gt;&lt;/div&gt;

Run it. You will find that it works as expected. 

Tomorrow, time permitting, I will tell you what's wrong with it and how you can fix it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-1834491843674778394?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/1834491843674778394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=1834491843674778394' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1834491843674778394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1834491843674778394'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/08/macros-and-hygiene-resumed.html' title='macros and hygiene, resumed'/><author><name>matthias</name><uri>http://www.blogger.com/profile/00000181081270224360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://www.ccs.neu.edu/home/matthias/Images/felleisen1.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-3142659106683415407</id><published>2007-08-03T14:06:00.000-04:00</published><updated>2007-08-03T14:24:34.143-04:00</updated><title type='text'>control and macros</title><content type='html'>After reading the posts on control operators, Vlado Zlatanov decided to
look into &lt;code&gt;prompt, control, fcontrol&lt;/code&gt; and the rest of the
goodies in &lt;code&gt;control.ss&lt;/code&gt;.

So based on the example from the blog post I did this python-like snippet: 

&lt;pre&gt;
(define/y (step) 
  (yield 1)
  (yield 2)
  (yield 3)
  'finished)
&lt;/pre&gt;

He decided to look into turning it into a macro, such that the above
ends up being correct code. When he got stuck, he asked on our mailing list
and the resulting dialog  was so informative that I decided to blog it. 

My first replay was this suggestion: 
&lt;div class="scheme"&gt;&lt;pre&gt;(&lt;span class="keyword"&gt;define-syntax&lt;/span&gt; &lt;span class="variable"&gt;define/y&lt;/span&gt;
  (&lt;span class="keyword"&gt;syntax-rules&lt;/span&gt; ()
    [(&lt;span class="variable"&gt;_&lt;/span&gt; &lt;span class="variable"&gt;yield-name&lt;/span&gt; (&lt;span class="variable"&gt;name&lt;/span&gt; &lt;span class="variable"&gt;arg&lt;/span&gt; ...) &lt;span class="variable"&gt;body&lt;/span&gt; ...)
     (&lt;span class="keyword"&gt;define&lt;/span&gt; (&lt;span class="variable"&gt;name&lt;/span&gt; &lt;span class="variable"&gt;arg&lt;/span&gt; ...)
       (&lt;span class="keyword"&gt;define&lt;/span&gt; &lt;span class="variable"&gt;exit-with&lt;/span&gt; &lt;span class="selfeval"&gt;#f&lt;/span&gt;)
       (&lt;span class="keyword"&gt;define&lt;/span&gt; (&lt;span class="variable"&gt;switch-control-context&lt;/span&gt; &lt;span class="variable"&gt;th&lt;/span&gt;)
         (&lt;span class="builtin"&gt;call/cc&lt;/span&gt; 
          (&lt;span class="keyword"&gt;lambda&lt;/span&gt; (&lt;span class="variable"&gt;k&lt;/span&gt;)
            (&lt;span class="keyword"&gt;set!&lt;/span&gt; &lt;span class="variable"&gt;exit-with&lt;/span&gt; &lt;span class="variable"&gt;k&lt;/span&gt;)
            (&lt;span class="variable"&gt;th&lt;/span&gt;))))
       (&lt;span class="keyword"&gt;define&lt;/span&gt; (&lt;span class="variable"&gt;yield-name&lt;/span&gt; &lt;span class="variable"&gt;x&lt;/span&gt;)
         (&lt;span class="builtin"&gt;call/cc&lt;/span&gt; 
          (&lt;span class="keyword"&gt;lambda&lt;/span&gt; (&lt;span class="variable"&gt;resume-here&lt;/span&gt;)
            (&lt;span class="keyword"&gt;set!&lt;/span&gt; &lt;span class="variable"&gt;name&lt;/span&gt; 
               (&lt;span class="keyword"&gt;lambda&lt;/span&gt; () 
                 (&lt;span class="variable"&gt;switch-control-context&lt;/span&gt; 
                  (&lt;span class="keyword"&gt;lambda&lt;/span&gt; () 
                     (&lt;span class="variable"&gt;resume-here&lt;/span&gt; &lt;span class="keyword"&gt;'&lt;/span&gt;&lt;span class="variable"&gt;dummy&lt;/span&gt;)))))
            (&lt;span class="variable"&gt;exit-with&lt;/span&gt; &lt;span class="variable"&gt;x&lt;/span&gt;))))
       (&lt;span class="variable"&gt;switch-control-context&lt;/span&gt; (&lt;span class="keyword"&gt;lambda&lt;/span&gt; () &lt;span class="variable"&gt;body&lt;/span&gt; ...)))]))&lt;/pre&gt;&lt;/div&gt;
I sent this out with two suggestions. 

First, use &lt;code&gt;control.ss&lt;/code&gt; to simplify the code. Second, use
&lt;code&gt;syntax-case&lt;/code&gt; to eliminate the need for the programmer-user of
&lt;code&gt;define/y&lt;/code&gt; to specify the name of &lt;code&gt;yield&lt;/code&gt;. 

So, here is the prompt-based code: 
&lt;div class="scheme"&gt;&lt;pre&gt;(&lt;span class="keyword"&gt;require&lt;/span&gt; (&lt;span class="variable"&gt;lib&lt;/span&gt; &lt;span class="selfeval"&gt;"control.ss"&lt;/span&gt;))

(&lt;span class="keyword"&gt;define-syntax&lt;/span&gt; &lt;span class="variable"&gt;define/y&lt;/span&gt;
  (&lt;span class="keyword"&gt;syntax-rules&lt;/span&gt; ()
    [(&lt;span class="variable"&gt;_&lt;/span&gt; &lt;span class="variable"&gt;yield-name&lt;/span&gt; (&lt;span class="variable"&gt;name&lt;/span&gt; &lt;span class="variable"&gt;arg&lt;/span&gt; ...) &lt;span class="variable"&gt;body&lt;/span&gt; ...)
     (&lt;span class="keyword"&gt;define&lt;/span&gt; (&lt;span class="variable"&gt;name&lt;/span&gt; &lt;span class="variable"&gt;arg&lt;/span&gt; ...)
       (&lt;span class="keyword"&gt;define&lt;/span&gt; (&lt;span class="variable"&gt;yield-name&lt;/span&gt; &lt;span class="variable"&gt;x&lt;/span&gt;)
         (&lt;span class="variable"&gt;control&lt;/span&gt; &lt;span class="variable"&gt;resume-here&lt;/span&gt;
            (&lt;span class="keyword"&gt;set!&lt;/span&gt; &lt;span class="variable"&gt;name&lt;/span&gt;
                  (&lt;span class="keyword"&gt;lambda&lt;/span&gt; ()
                    (&lt;span class="variable"&gt;prompt&lt;/span&gt; (&lt;span class="variable"&gt;resume-here&lt;/span&gt; &lt;span class="keyword"&gt;'&lt;/span&gt;&lt;span class="variable"&gt;dummy&lt;/span&gt;))))
            &lt;span class="variable"&gt;x&lt;/span&gt;))
       (&lt;span class="variable"&gt;prompt&lt;/span&gt; &lt;span class="variable"&gt;body&lt;/span&gt; ...))]))

(&lt;span class="variable"&gt;define/y&lt;/span&gt; &lt;span class="variable"&gt;yield&lt;/span&gt; (&lt;span class="variable"&gt;step&lt;/span&gt;) 
  (&lt;span class="variable"&gt;yield&lt;/span&gt; &lt;span class="selfeval"&gt;1&lt;/span&gt;)
  (&lt;span class="variable"&gt;yield&lt;/span&gt; &lt;span class="selfeval"&gt;2&lt;/span&gt;)
  (&lt;span class="variable"&gt;yield&lt;/span&gt; &lt;span class="selfeval"&gt;3&lt;/span&gt;)
  &lt;span class="keyword"&gt;'&lt;/span&gt;&lt;span class="variable"&gt;finished&lt;/span&gt;)

(&lt;span class="builtin"&gt;equal?&lt;/span&gt; &lt;span class="keyword"&gt;'&lt;/span&gt;(&lt;span class="selfeval"&gt;1&lt;/span&gt; &lt;span class="selfeval"&gt;2&lt;/span&gt; &lt;span class="selfeval"&gt;3&lt;/span&gt;) (&lt;span class="builtin"&gt;list&lt;/span&gt; (&lt;span class="variable"&gt;step&lt;/span&gt;) (&lt;span class="variable"&gt;step&lt;/span&gt;) (&lt;span class="variable"&gt;step&lt;/span&gt;)))&lt;/pre&gt;&lt;/div&gt;

This time I include a test case that assures the proper return behavior of
&lt;code&gt;yield&lt;/code&gt;. The definition of &lt;code&gt;define/y&lt;/code&gt; shows how to
mark the return point with &lt;code&gt;prompt&lt;/code&gt; and how to switch to this
point with &lt;code&gt;control&lt;/code&gt; so that your generator can resume the
traversal at the place where it was interrupted. 

For the second challenge, I wrote this definition: 
&lt;div class="scheme"&gt;&lt;pre&gt;(&lt;span class="keyword"&gt;require&lt;/span&gt; (&lt;span class="variable"&gt;lib&lt;/span&gt; &lt;span class="selfeval"&gt;"control.ss"&lt;/span&gt;))

(&lt;span class="keyword"&gt;define-syntax&lt;/span&gt; (&lt;span class="variable"&gt;define/y&lt;/span&gt; &lt;span class="variable"&gt;stx&lt;/span&gt;)
  (&lt;span class="keyword"&gt;syntax-case&lt;/span&gt; &lt;span class="variable"&gt;stx&lt;/span&gt; ()
    [(&lt;span class="variable"&gt;_&lt;/span&gt; (&lt;span class="variable"&gt;name&lt;/span&gt; &lt;span class="variable"&gt;arg&lt;/span&gt; ...) &lt;span class="variable"&gt;body&lt;/span&gt; ...)
     (&lt;span class="keyword"&gt;with-syntax&lt;/span&gt; 
         ((&lt;span class="variable"&gt;yield-name&lt;/span&gt; (&lt;span class="builtin"&gt;datum-&amp;gt;syntax-object&lt;/span&gt; &lt;span class="variable"&gt;stx&lt;/span&gt; &lt;span class="keyword"&gt;'&lt;/span&gt;&lt;span class="variable"&gt;yield&lt;/span&gt;)))
       (&lt;span class="keyword"&gt;syntax&lt;/span&gt;
        (&lt;span class="keyword"&gt;define&lt;/span&gt; (&lt;span class="variable"&gt;name&lt;/span&gt; &lt;span class="variable"&gt;arg&lt;/span&gt; ...)
          (&lt;span class="keyword"&gt;define&lt;/span&gt; (&lt;span class="variable"&gt;yield-name&lt;/span&gt; &lt;span class="variable"&gt;x&lt;/span&gt;)
            (&lt;span class="variable"&gt;control&lt;/span&gt; &lt;span class="variable"&gt;resume-here&lt;/span&gt;
             (&lt;span class="keyword"&gt;set!&lt;/span&gt; &lt;span class="variable"&gt;name&lt;/span&gt; 
                   (&lt;span class="keyword"&gt;lambda&lt;/span&gt; ()
                     (&lt;span class="variable"&gt;prompt&lt;/span&gt; (&lt;span class="variable"&gt;resume-here&lt;/span&gt; &lt;span class="keyword"&gt;'&lt;/span&gt;&lt;span class="variable"&gt;dummy&lt;/span&gt;))))
             &lt;span class="variable"&gt;x&lt;/span&gt;))
          (&lt;span class="variable"&gt;prompt&lt;/span&gt; &lt;span class="variable"&gt;body&lt;/span&gt; ...))))]))

(&lt;span class="variable"&gt;define/y&lt;/span&gt; (&lt;span class="variable"&gt;step&lt;/span&gt;) 
  (&lt;span class="variable"&gt;yield&lt;/span&gt; &lt;span class="selfeval"&gt;1&lt;/span&gt;)
  (&lt;span class="variable"&gt;yield&lt;/span&gt; &lt;span class="selfeval"&gt;2&lt;/span&gt;)
  (&lt;span class="variable"&gt;yield&lt;/span&gt; &lt;span class="selfeval"&gt;3&lt;/span&gt;)
  &lt;span class="keyword"&gt;'&lt;/span&gt;&lt;span class="variable"&gt;finished&lt;/span&gt;)

(&lt;span class="builtin"&gt;equal?&lt;/span&gt; &lt;span class="keyword"&gt;'&lt;/span&gt;(&lt;span class="selfeval"&gt;1&lt;/span&gt; &lt;span class="selfeval"&gt;2&lt;/span&gt; &lt;span class="selfeval"&gt;3&lt;/span&gt;) (&lt;span class="builtin"&gt;list&lt;/span&gt; (&lt;span class="variable"&gt;step&lt;/span&gt;) (&lt;span class="variable"&gt;step&lt;/span&gt;) (&lt;span class="variable"&gt;step&lt;/span&gt;)))&lt;/pre&gt;&lt;/div&gt;

If you compare the two macro definitions, you notice very little
difference. Indeed, what really differs is the "interface" (the API), that
is, the way you can use the macro: see the test case. What also differs is
that the definition uses &lt;code&gt;syntax-case&lt;/code&gt; and
&lt;code&gt;with-syntax&lt;/code&gt; to inject &lt;code&gt;yield&lt;/code&gt; into the body of
&lt;code&gt;define/y&lt;/code&gt;.

In response, Vlado wrote "but isn't this non-hygienic." Here is my
response: 

&lt;blockquote&gt;
Hygiene is a uniformity default imposed on the expander with a provision
for programmers to choose the non-default. I chose this word  carefully
when I coined the phrase. So what you have *is* a hygienic solution. 
&lt;/blockquote&gt;

In other words, injecting an identifier into a macro is not a violation of
hygiene at all. It's just means using the full power of the macro system.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-3142659106683415407?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/3142659106683415407/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=3142659106683415407' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/3142659106683415407'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/3142659106683415407'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/08/control-and-macros.html' title='control and macros'/><author><name>matthias</name><uri>http://www.blogger.com/profile/00000181081270224360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://www.ccs.neu.edu/home/matthias/Images/felleisen1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-2279205445911348013</id><published>2007-08-03T05:35:00.000-04:00</published><updated>2007-08-03T17:42:59.662-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='industrial'/><title type='text'>Experience Report: Scheme in Commercial Web Application Development</title><content type='html'>&lt;p&gt;Our paper &lt;a href="http://www.untyped.com/downloads/icfp068-welsh.pdf"&gt;&amp;ldquo;Experience Report: Scheme in Commercial Web Application Development&amp;rdquo;&lt;/a&gt; is online.  As the title suggests, it describes our experiences over the past year developing a number of web-based applications in PLT Scheme.  If we'd chosen a language like Java or Ruby we could have used a large number of libraries developed for web apps, whereas PLT Scheme has relatively few libraries in this area, and they haven't been tested under high load.  So we were gambling that Scheme would make us so productive we could develop our own libraries &lt;em&gt;and&lt;/em&gt; the applications we were contracted to produce in the same  time it would take to develop just the applications in another language.  It was a gamble that paid off.  You'll have to read the paper for all the details, but suffice to say we delivered the applications on time (and more are in development) and our libraries already compare well against big names like Ruby on Rails and J2EE.&lt;/p&gt;

&lt;p&gt;On thing that got cut from the paper was our use of &lt;a href="http://www.flapjax-lang.org/"&gt;Flapjax&lt;/a&gt; is parts of the interface.  If you write complicated Javascript to take a look at it.  It really does simplify event handling, and our code using Flapjax is half the size of our original code without it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; This is more or less the same post as on &lt;a href="http://www.untyped.com/untyping/archives/2007/08/a_scheme_case_s_1.html"&gt;Untyping&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-2279205445911348013?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.untyped.com/downloads/icfp068-welsh.pdf' title='Experience Report: Scheme in Commercial Web Application Development'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/2279205445911348013/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=2279205445911348013' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2279205445911348013'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2279205445911348013'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/08/experience-report-scheme-in-commercial.html' title='Experience Report: Scheme in Commercial Web Application Development'/><author><name>Noel</name><uri>http://www.blogger.com/profile/09666551093622614632</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-2363092744453831941</id><published>2007-08-02T18:03:00.000-04:00</published><updated>2007-08-03T07:24:17.367-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='academic'/><title type='text'>Relationally-Parametric Polymorphic Contracts</title><content type='html'>&lt;p&gt;
We've been making progress on the connection between types and
contracts.  This paper is a step towards answering the question, 
“What would polymorphic types (a la Standard ML) look like in a
contract world?”  If you haven't thought much about polymorphic
types, you may find the answer has some subtlety; if you have,
hopefully you will find the answer reasonable.
&lt;/p&gt;

&lt;p&gt;
Arjun and I want to point out that some of the work in this
paper was already in an earlier paper that Jacob and Robby wrote, but
the material was excised from the public version, so we weren't aware
of it.  But there is some fresh material here as well, and anyway
Robby and I have been gabbing about this question for years.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-2363092744453831941?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.cs.brown.edu/~sk/Publications/Papers/Published/gmfk-rel-par-poly-cont/' title='Relationally-Parametric Polymorphic Contracts'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/2363092744453831941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=2363092744453831941' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2363092744453831941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2363092744453831941'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/08/relationally-parametric-polymorphic.html' title='Relationally-Parametric Polymorphic Contracts'/><author><name>Shriram Krishnamurthi</name><uri>http://www.blogger.com/profile/02956763366608000839</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-5517053676294986274</id><published>2007-07-30T11:55:00.000-04:00</published><updated>2007-08-02T18:16:13.383-04:00</updated><title type='text'>control, resumed</title><content type='html'>Since at least some people helped me re-re-invent prompt after my last post, I thought I would remind people that PLT Scheme is the &lt;em&gt;only&lt;/em&gt; production system in the world that provides delimited and (truly) composable continuations directly (and w/o loss of TCO properties). So here is the same fragment again: 

&lt;div class="scheme"&gt;&lt;pre&gt;(&lt;span class="keyword"&gt;require&lt;/span&gt; (&lt;span class="variable"&gt;lib&lt;/span&gt; &lt;span class="selfeval"&gt;"control.ss"&lt;/span&gt;))

(&lt;span class="keyword"&gt;define&lt;/span&gt; (&lt;span class="variable"&gt;generate-one-element-at-a-time&lt;/span&gt; &lt;span class="variable"&gt;a-list&lt;/span&gt;)
  (&lt;span class="keyword"&gt;define&lt;/span&gt; (&lt;span class="variable"&gt;control-state&lt;/span&gt;)
    (&lt;span class="builtin"&gt;for-each&lt;/span&gt; (&lt;span class="keyword"&gt;lambda&lt;/span&gt; (&lt;span class="variable"&gt;an-element-from-a-list&lt;/span&gt;)
  (&lt;span class="variable"&gt;control&lt;/span&gt; &lt;span class="variable"&gt;resume-here&lt;/span&gt;
    (&lt;span class="keyword"&gt;set!&lt;/span&gt; &lt;span class="variable"&gt;control-state&lt;/span&gt; &lt;span class="variable"&gt;resume-here&lt;/span&gt;)
    &lt;span class="variable"&gt;an-element-from-a-list&lt;/span&gt;))
              &lt;span class="variable"&gt;a-list&lt;/span&gt;)
    &lt;span class="keyword"&gt;'&lt;/span&gt;&lt;span class="variable"&gt;you-fell-off-the-end-off-the-list&lt;/span&gt;)
  (&lt;span class="keyword"&gt;define&lt;/span&gt; (&lt;span class="variable"&gt;generator&lt;/span&gt;) (&lt;span class="variable"&gt;prompt&lt;/span&gt; (&lt;span class="variable"&gt;control-state&lt;/span&gt;)))
  &lt;span class="variable"&gt;generator&lt;/span&gt;)&lt;/pre&gt;&lt;/div&gt;

Take a look, compare and contrast with the previous post. Time permitting, I will continue to show you another control poem soon. P.S. See &lt;a href="http://www.ccs.neu.edu/scheme/pubs/#icfp07-fyf"&gt;Adding Delimited and Composable Control to a Production Programming Environment &lt;/a&gt; for details.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-5517053676294986274?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/5517053676294986274/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=5517053676294986274' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/5517053676294986274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/5517053676294986274'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/07/control-resumed.html' title='control, resumed'/><author><name>matthias</name><uri>http://www.blogger.com/profile/00000181081270224360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://www.ccs.neu.edu/home/matthias/Images/felleisen1.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-2698032372224392708</id><published>2007-07-27T18:45:00.000-04:00</published><updated>2007-07-30T06:45:46.070-04:00</updated><title type='text'>call/cc and self-modifying code</title><content type='html'>Today I wrote this short illustration of call/cc and posted it on wikipedia: 

&lt;div class="scheme"&gt;&lt;pre&gt;&lt;span class="comment"&gt;;; [LISTOF X] -&amp;gt; ( -&amp;gt; X u 'you-fell-off-the-end-off-the-list)
&lt;/span&gt;(&lt;span class="keyword"&gt;define&lt;/span&gt; (&lt;span class="variable"&gt;generate-one-element-at-a-time&lt;/span&gt; &lt;span class="variable"&gt;a-list&lt;/span&gt;)
  &lt;span class="comment"&gt;;; (-&amp;gt; X u 'you-fell-off-the-end-off-the-list)
&lt;/span&gt;  &lt;span class="comment"&gt;;; this is the actual generator, producing one item from a-list at a time
&lt;/span&gt;  (&lt;span class="keyword"&gt;define&lt;/span&gt; (&lt;span class="variable"&gt;generator&lt;/span&gt;)
     (&lt;span class="builtin"&gt;call/cc&lt;/span&gt; &lt;span class="variable"&gt;control-state&lt;/span&gt;)) 
  &lt;span class="comment"&gt;;; [CONTINUATION X] -&amp;gt; EMPTY
&lt;/span&gt;  &lt;span class="comment"&gt;;; hand the next item from a-list to "return" (or an end-of-list marker)'
&lt;/span&gt;  (&lt;span class="keyword"&gt;define&lt;/span&gt; (&lt;span class="variable"&gt;control-state&lt;/span&gt; &lt;span class="variable"&gt;return&lt;/span&gt;)
     (&lt;span class="builtin"&gt;for-each&lt;/span&gt; 
        (&lt;span class="keyword"&gt;lambda&lt;/span&gt; (&lt;span class="variable"&gt;an-element-from-a-list&lt;/span&gt;)
           (&lt;span class="builtin"&gt;set! return&lt;/span&gt; ;; fixed
             (&lt;span class="builtin"&gt;call/cc&lt;/span&gt;
               (&lt;span class="keyword"&gt;lambda&lt;/span&gt; (&lt;span class="variable"&gt;resume-here&lt;/span&gt;)
                 (&lt;span class="keyword"&gt;set!&lt;/span&gt; &lt;span class="variable"&gt;control-state&lt;/span&gt; &lt;span class="variable"&gt;resume-here&lt;/span&gt;)
                 (&lt;span class="variable"&gt;return&lt;/span&gt; &lt;span class="variable"&gt;an-element-from-a-list&lt;/span&gt;)))))
        &lt;span class="variable"&gt;a-list&lt;/span&gt;)
     (&lt;span class="variable"&gt;return&lt;/span&gt; &lt;span class="keyword"&gt;'&lt;/span&gt;&lt;span class="variable"&gt;you-fell-off-the-end-off-the-list&lt;/span&gt;))
  &lt;span class="comment"&gt;;; time to return the generator
&lt;/span&gt;  &lt;span class="variable"&gt;generator&lt;/span&gt;)
&lt;/pre&gt;&lt;/div&gt;

It reminded of all the talk in the 1980s and 1990s that self-modifying code is bad. But look at the elegant assignment to &lt;code&gt;control-state&lt;/code&gt; within its body. It's such a poem, I thought I'd share it with people since nobody else blogs here anywya.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-2698032372224392708?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/2698032372224392708/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=2698032372224392708' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2698032372224392708'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2698032372224392708'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/07/callcc-and-self-modifying-code.html' title='call/cc and self-modifying code'/><author><name>matthias</name><uri>http://www.blogger.com/profile/00000181081270224360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://www.ccs.neu.edu/home/matthias/Images/felleisen1.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-7201123380885059455</id><published>2007-06-14T14:05:00.000-04:00</published><updated>2007-06-14T14:12:16.384-04:00</updated><title type='text'>Small is Beautiful, Large is Useful, and Scheme is Both</title><content type='html'>&lt;p&gt; They say, Scheme is small and this is good.

&lt;p&gt; Have you heard of X? No? It is &lt;strong&gt;the&lt;/strong&gt; smallest computational basis. It is a single function that can compute everything a Turing machine can compute; a Church lambda calculus; a Post model; a RAM; a what-have-you model of computation. Indeed, X is so simple that two equations suffice to specify it completely [&lt;a href="http://www.andrew.cmu.edu/user/cebrown/notes/barendregt.html"&gt;Barendregt&lt;/a&gt;, &lt;a href="http://www.andrew.cmu.edu/user/cebrown/notes/barendregt.html#8"&gt;page 166&lt;/a&gt;]. Imagine that: a complete language report in two lines; a compiler that fits in a few K instead of Ms; no more arguments about smallness. 

&lt;p&gt; Small alone can't be any good. If you used X alone, your programs would be the size of the universe or something like that. That's what the theory of computability teaches us [&lt;a href="http://en.wikipedia.org/wiki/Church-Turing_thesis"&gt;Church and Turing&lt;/a&gt;]. Adding LAMBDA and a few primitives to get a pure functional language isn't good enough either. That's what the theory of expressiveness shows [&lt;a href="http://www.ccs.neu.edu/scheme/pubs/#scp91-felleisen"&gt;Felleisen&lt;/a&gt;; &lt;a href="http://theory.stanford.edu/people/jcm/publications.htm"&gt;Mitchell&lt;/a&gt;; &lt;a href="http://portal.acm.org/citation.cfm?id=99583.99617"&gt;Riecke&lt;/a&gt;]. And, using an R5RS Scheme to build large systems with many people at a dozen sites isn't doable either. That's what the PLT experience determined.

&lt;p&gt;When we set out to construct DrScheme using MzScheme, we also conducted an experiment:
&lt;blockquote&gt;
 Could we really build a graphical system that manages (shared) resources and that provides excellent error feedback with just plain Scheme? 
&lt;/blockquote&gt;
 Could we just add enough libraries to do all this? Or would we have to change the kernel of the language?  As much as we tried to keep MzScheme small, it became clear quickly that we needed exceptions, structures, module-like features, a mechanism for concurrency, a way to manage resources such as windows, tcp connections, and so on. The list isn't infinite but it is much longer than I expected. Our "Revenge of the Son of the LISP machine" paper is a good summary for the state of the art around 1999 [&lt;a href="http://www.cs.utah.edu/~mflatt/publications/index.html"&gt;Flatt and Son&lt;/a&gt;].

&lt;p&gt;As language designers we stepped back time and again to look at our monster. What could we remove? What would we have to add in response? For some five years, we had first-class modules (units) and first-class classes in the core of the language. We had almost banned macros. They were so ugly I stopped teaching about them because I did want to use our own dog food in my courses but I couldn't stomach the macro system. It was such a step back from Eugene's extend-syntax. But then Matthew figured out the next big step in macro and module technology [&lt;a href="http://www.cs.utah.edu/~mflatt/publications/index.html"&gt;Flatt, You Want It When?&lt;/a&gt;]. And with that out went units and classes from the core and many other things. So we learned lessons, and we need to keep building systems to learn more.

&lt;p&gt;I have no question that the idea of Scheme is beautiful. At the same time, I have also learned that if I wish to use this beautiful idea in practice, I need to add the ingredients that it takes to build large systems. R6RS reflects this insight, and I am happy about it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-7201123380885059455?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/7201123380885059455/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=7201123380885059455' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/7201123380885059455'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/7201123380885059455'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/06/small-is-beautiful-large-is-useful-and.html' title='Small is Beautiful, Large is Useful, and Scheme is Both'/><author><name>matthias</name><uri>http://www.blogger.com/profile/00000181081270224360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://www.ccs.neu.edu/home/matthias/Images/felleisen1.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-994848006948347841</id><published>2007-06-09T13:15:00.000-04:00</published><updated>2007-06-09T13:41:54.952-04:00</updated><title type='text'>R6RS is "perfect"</title><content type='html'>&lt;p&gt;
When I read the "side by side" and "head to head" descriptions of the alternatives facing the Scheme community (see Comp.Lang.Scheme and the R6RS mailing list), I am wondering which one is which and which one is better.&lt;/p&gt;&lt;p&gt;
&lt;ul&gt;
 &lt;li&gt; Is it really good that Scheme (the spec) doesn't support a module system?
 &lt;li&gt; Is it really good that almost all major implementations support their own version of a module system?
 &lt;li&gt; Is it really good that programmers can't even leave the module structure intact when porting code?
&lt;/ul&gt;&lt;/p&gt;&lt;p&gt;
Imagine your own similar questions and add them here. We have lived in a side-by-side universe for a long time, and there are quite a few programmers who have suffered from this not-really-the-same-language problem. Besides the module system, there are other not-quite-the-same-but-related features that implementations have and programmers wish to use.&lt;/p&gt;&lt;p&gt;
The R6RS process has pushed several major implementors/implementations to agree on a design for module systems and other constructs. Their report declares that they are ready to put a large amount of work in to get from r5rs to r6rs. I believe that this step would help the community in several arenas, listed in increasing order of relevance:
&lt;ol&gt;
&lt;li&gt;the academic publishing business
&lt;li&gt;the fund raising business 
&lt;li&gt;adapting each others innovations
&lt;li&gt;supporting programmers who learn on one and switch to another implementation
&lt;li&gt;supporting commercial programmers who need reassurance that there is more than one implementation and implementor [ever attended Commercial Uses of Functional Programming?]
&lt;/ol&gt;&lt;/p&gt;&lt;p&gt;
Is the document perfect? Is every construct exactly the 'right thing'? Of course not! Guy and Gerry revised their first Scheme report because they didn't get it 'right'. R3RS and R4RS and R5RS revised flaws in R(n-1)RS because the authors/editors didn't get it 'right'. It is extremely difficult, and usually impossible, to get the design of a complex artifacts (such as a programming language) 'right' the first time. In these cases, it's all about the feedback loop and revising your design based on observations. (Remember the 'science' part in the name of our discipline?)  Indeed, 'right' doesn't exist; what exists is 'most pragmatic and internally beautiful,' and nothing else. 
&lt;/p&gt;&lt;p&gt;Our choice is quite simple: move forward as a community with some amount of convergence (r6rs) or split into dozens of mutually incompatible sub-communities (status quo, including SRFIs).&lt;/p&gt;&lt;p&gt;
&lt;em&gt;Also posted as &lt;a href="http://lists.r6rs.org/pipermail/r6rs-discuss/2007-June/002538.html"&gt;
"R6RS is perfect"&lt;/a&gt; at the R6RS discussion list.&lt;/em&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-994848006948347841?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/994848006948347841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=994848006948347841' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/994848006948347841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/994848006948347841'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/06/r6rs-is-perfect.html' title='R6RS is &quot;perfect&quot;'/><author><name>matthias</name><uri>http://www.blogger.com/profile/00000181081270224360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://www.ccs.neu.edu/home/matthias/Images/felleisen1.jpg'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-2262217151421897845</id><published>2007-05-22T02:38:00.000-04:00</published><updated>2011-11-09T22:52:20.898-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='release'/><title type='text'>PLT Scheme version 370</title><content type='html'>&lt;div align="left"&gt;PLT Scheme version 370 is now available from
&lt;p&gt;&lt;center&gt;
&lt;a href="http://download.plt-scheme.org/"&gt;http://download.plt-scheme.org/&lt;/a&gt;
&lt;/center&gt;
&lt;/p&gt;
Some highlights: &lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The conservative garbage collector (CGC) has been replaced with a
precise garbage collector (3m) in the standard build. For most
users, this change simply amounts to "better performance in space
and time". For example, a long-running DrScheme instance typically
uses much less memory than before.&lt;/p&gt;
&lt;p&gt;
The new memory manager also supports a new "Limit Memory..." option
(in DrScheme's "Scheme" menu) to limit the memory use of a
programming running inside DrScheme.&lt;/p&gt;
&lt;p&gt;
For those who work with C-implemented libraries and extensions, the
switch to precise collection may complicate interoperability. To a
large extent, however, &lt;span style="font-family:courier new;"&gt;(lib "foreign.ss")&lt;/span&gt; works the same with both
collectors. (But note that the 3m is a moving collector, so be
careful with passing Scheme objects to C.)
&lt;/p&gt;&lt;p&gt;
Although our pre-built binaries use the new collector, builds from
source using the conservative collector are still supported.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;For a program written with one of the the &lt;a href="http://www.htdp.org"&gt;"How to Design Programs"&lt;/a&gt;
(HtDP) languages, DrScheme saves the program with meta-information
that identifies the language and records the teachpacks used by the
program. DrScheme's teachpack GUI now works only with the HtDP
languages. In other languages, use &lt;span style="font-family:courier new;"&gt;require&lt;/span&gt; to access teachpacks.&lt;/p&gt;
&lt;p&gt;
The meta-information is in the form of a reader extension that turns
the file content into a &lt;span style="font-family:courier new;"&gt;module&lt;/span&gt;-based program, which means that
teaching-language files can be loaded directly into MzScheme or used
with other PLT Scheme tools.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The HtDP &lt;span style="font-family:courier new;"&gt;"world.ss"&lt;/span&gt; and &lt;span style="font-family:courier new;"&gt;"image.ss"&lt;/span&gt; teachpacks have been revised,
including support for the creation of animated GIFs.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unit-based servlets are no longer supported in the web server. Use
module-based servlets, instead. (Servlets can be implemented using
a &lt;span style="font-family:courier new;"&gt;unit&lt;/span&gt; within a module, but the web server's API is provided
through a module.)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A new &lt;span style="font-family:courier new;"&gt;(lib "unit.ss")&lt;/span&gt; library replaces the old one and provides a
simpler and more flexible syntax. The &lt;span style="font-family:courier new;"&gt;(lib "unitsig.ss")&lt;/span&gt; library
is deprecated but still available as &lt;span style="font-family:courier new;"&gt;(lib "unitsig200.ss")&lt;/span&gt;, and
the old &lt;span style="font-family:courier new;"&gt;(lib "unit.ss")&lt;/span&gt; is available as &lt;span style="font-family:courier new;"&gt;(lib "unit200.ss")&lt;/span&gt;. &lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Feedback Welcome, &lt;/p&gt;
&lt;p&gt;&lt;em&gt;The PLT Scheme Team
&lt;/em&gt;&lt;/p&gt;&lt;a href="http://download.plt-scheme.org/"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-2262217151421897845?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://download.plt-scheme.org/' title='PLT Scheme version 370'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/2262217151421897845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=2262217151421897845' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2262217151421897845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/2262217151421897845'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/05/plt-scheme-version-370.html' title='PLT Scheme version 370'/><author><name>Jens Axel Søgaard</name><uri>http://www.blogger.com/profile/15211030864341077735</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-3788111355860084168</id><published>2007-05-16T17:34:00.000-04:00</published><updated>2007-05-17T03:36:31.800-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='typed-scheme'/><category scheme='http://www.blogger.com/atom/ns#' term='script'/><title type='text'>Looking for small Scheme scripts</title><content type='html'>&lt;p&gt;As part of the &lt;a href="http://www.ccs.neu.edu/%7Esamth/typed-scheme.html"&gt;Typed Scheme&lt;/a&gt; project, we are looking for small Scheme scripts that we can port from PLT Scheme to Typed Scheme.  We would like to investigate if Typed Scheme is capable of checking idiomatic PLT Scheme code, as represented by scripts written by members of the PLT Scheme community.
&lt;/p&gt;&lt;p&gt;
Therefore, if you have a simple PLT Scheme program which handles a scripting/processing task, and you are willing to share it with us for the improvement of Typed Scheme, please let &lt;a href="mailto:samth@ccs.neu.edu"&gt;me&lt;/a&gt; know.  Typed Scheme currently handles all of 'core' MzScheme, as well as many of the collections (the major exceptions are the class and unit systems).
&lt;/p&gt;&lt;p&gt;
In return, we will inform you of any bugs that we discover during the port.
&lt;/p&gt;&lt;p&gt;
More information about Typed Scheme is available from the webpage:
&lt;a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.ccs.neu.edu/%7Esamth/typed-scheme.html" target="_blank"&gt;http://www.ccs.neu.edu/~samth&lt;wbr&gt;/typed-scheme.html&lt;/a&gt;
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-3788111355860084168?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/3788111355860084168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=3788111355860084168' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/3788111355860084168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/3788111355860084168'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/05/looking-for-small-scheme-scripts.html' title='Looking for small Scheme scripts'/><author><name>Sam Tobin-Hochstadt</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-8672000052255493553</id><published>2007-05-10T12:48:00.000-04:00</published><updated>2007-05-10T13:46:37.216-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='keybindings'/><category scheme='http://www.blogger.com/atom/ns#' term='drscheme'/><title type='text'>Adjusting DrScheme's Keybindings</title><content type='html'>Check out &lt;span class="sg"&gt;Kyle Smith&lt;/span&gt;'s blog post on how to change &lt;a href="http://www.drscheme.org/"&gt;DrScheme&lt;/a&gt;'s keybindings:

&lt;div style="text-align: center;"&gt;&lt;a href="http://schemekeys.blogspot.com/2007/05/keybinding-101-in-drscheme.html"&gt;Keybinding 101 in DrScheme&lt;/a&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-8672000052255493553?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://schemekeys.blogspot.com/2007/05/keybinding-101-in-drscheme.html' title='Adjusting DrScheme&apos;s Keybindings'/><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/8672000052255493553/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=8672000052255493553' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8672000052255493553'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/8672000052255493553'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/05/adjusting-drschemes-keybindings.html' title='Adjusting DrScheme&apos;s Keybindings'/><author><name>Robby</name><uri>http://www.blogger.com/profile/08402308775580442837</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='13' height='32' src='http://people.cs.uchicago.edu/~robby/portrait-2006.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-1965802899884148737</id><published>2007-05-10T12:04:00.000-04:00</published><updated>2007-05-10T07:11:32.781-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><category scheme='http://www.blogger.com/atom/ns#' term='macros'/><title type='text'>XML Transformation in Scheme</title><content type='html'>&lt;p&gt;&lt;a href="http://www.openqa.org/selenium/"&gt;Selenium&lt;/a&gt; is a tool for testing web applications, the core of which is a Javascript library that controls a web browser.  With the &lt;a href="http://www.openqa.org/selenium-ide/"&gt;Selenium IDE&lt;/a&gt; you can convert your actions in a web browser into tests, and with the &lt;a href="http://www.openqa.org/selenium-rc/"&gt;Selenium Remote Control&lt;/a&gt; you can control a web browser from code.  I've recently been working on adding Selenium Remote Control bindings to PLT Scheme, which has resulted in a nice and hopefully instructional demonstration of XML transformation in PLT Scheme&lt;/p&gt;

&lt;p&gt;The Selenium Remote Control is controlled by sending simple messages over HTTP.  The format of the messages isn't important.  What is, is that there are a lot of them, and the API is specified in a file called &lt;code&gt;iedoc.xml&lt;/code&gt; that comes with Selenium.  The Java/Python/Ruby bindings are generated using &lt;a href="http://www.w3.org/Style/XSL/"&gt;XSL&lt;/a&gt;.  If I was to use XSL I'd have a processing pipeline that uses three languages (XSL, Java, Scheme) which is two more than I'd like.  Hence I turned to &lt;a href="http://planet.plt-scheme.org/display.ss?package=webit.plt&amp;owner=jim"&gt;WebIt!&lt;/a&gt;, an XML transformation DSL written in Scheme, to create an all Scheme pipeline.  The rest of this post wshows the steps I used to transform the Selenium API into Scheme code using WebIt!  I think this is interesting in its own right, but also serves as a nice demonstration of the power of macros, which WebIt! makes extensive use of.&lt;/p&gt;

&lt;p&gt;My first step is to get an idea of the structure of the XML.  The  bits I'm interested in look like this:&lt;/p&gt;

&lt;pre&gt;
&amp;lt;function name="click"&amp;gt;
  &amp;lt;param name="locator"&amp;gt;an element locator&amp;lt;/param&amp;gt;
  &amp;lt;comment&amp;gt;Clicks on a link, button, checkbox or radio button.
  If the click action causes a new page to load (like a link usually
  does), call waitForPageToLoad.&amp;lt;/comment&amp;gt;
&amp;lt;/function&amp;gt;
&lt;/pre&gt;

&lt;p&gt;Let's read in the XML file and extract all the &lt;code&gt;function&lt;/code&gt; elements.  For this I'll use SSAX and SXPath:&lt;/p&gt;

&lt;div class="scheme"&gt;&lt;pre&gt;(&lt;span class="keyword"&gt;require&lt;/span&gt;
 (&lt;span class="variable"&gt;planet&lt;/span&gt; &lt;span class="selfeval"&gt;"ssax.ss"&lt;/span&gt; (&lt;span class="selfeval"&gt;"lizorkin"&lt;/span&gt; &lt;span class="selfeval"&gt;"ssax.plt"&lt;/span&gt; &lt;span class="selfeval"&gt;1&lt;/span&gt;))
 (&lt;span class="variable"&gt;only&lt;/span&gt; (&lt;span class="variable"&gt;planet&lt;/span&gt; &lt;span class="selfeval"&gt;"sxml.ss"&lt;/span&gt; (&lt;span class="selfeval"&gt;"lizorkin"&lt;/span&gt; &lt;span class="selfeval"&gt;"sxml.plt"&lt;/span&gt; &lt;span class="selfeval"&gt;1&lt;/span&gt;)) &lt;span class="variable"&gt;sxpath&lt;/span&gt;))

(&lt;span class="keyword"&gt;define&lt;/span&gt; &lt;span class="variable"&gt;api&lt;/span&gt;
  (&lt;span class="builtin"&gt;with-input-from-file&lt;/span&gt; &lt;span class="selfeval"&gt;"iedoc.xml"&lt;/span&gt;
    (&lt;span class="keyword"&gt;lambda&lt;/span&gt; () (&lt;span class="variable"&gt;ssax:xml-&amp;gt;sxml&lt;/span&gt; (&lt;span class="builtin"&gt;current-input-port&lt;/span&gt;) &lt;span class="keyword"&gt;'&lt;/span&gt;()))))

(&lt;span class="keyword"&gt;define&lt;/span&gt; &lt;span class="variable"&gt;functions&lt;/span&gt;
  ((&lt;span class="variable"&gt;sxpath&lt;/span&gt; &lt;span class="keyword"&gt;'&lt;/span&gt;(&lt;span class="variable"&gt;//&lt;/span&gt; &lt;span class="variable"&gt;function&lt;/span&gt;)) &lt;span class="variable"&gt;api&lt;/span&gt;))&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Ok, so we have all the functions.  Now let's parse them into a more useful datastructure.  Here's my first attempt:&lt;/p&gt;

&lt;div class="scheme"&gt;&lt;pre&gt;(&lt;span class="keyword"&gt;require&lt;/span&gt; (&lt;span class="variable"&gt;planet&lt;/span&gt; &lt;span class="selfeval"&gt;"xml.ss"&lt;/span&gt; (&lt;span class="selfeval"&gt;"jim"&lt;/span&gt; &lt;span class="selfeval"&gt;"webit.plt"&lt;/span&gt; &lt;span class="selfeval"&gt;1&lt;/span&gt; &lt;span class="selfeval"&gt;5&lt;/span&gt;)))

&lt;span class="comment"&gt;;; struct function : string (listof string)
&lt;/span&gt;(&lt;span class="keyword"&gt;define-struct&lt;/span&gt; &lt;span class="variable"&gt;function&lt;/span&gt; (&lt;span class="variable"&gt;name&lt;/span&gt; &lt;span class="variable"&gt;params&lt;/span&gt;))

&lt;span class="comment"&gt;;; parse-function : sxml -&amp;gt; function
&lt;/span&gt;(&lt;span class="keyword"&gt;define&lt;/span&gt; (&lt;span class="variable"&gt;parse-function&lt;/span&gt; &lt;span class="variable"&gt;fn&lt;/span&gt;)
  (&lt;span class="variable"&gt;xml-match&lt;/span&gt; &lt;span class="variable"&gt;fn&lt;/span&gt;
    [(&lt;span class="variable"&gt;function&lt;/span&gt; &lt;span class="variable"&gt;name:&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;name&lt;/span&gt;
               (&lt;span class="variable"&gt;param&lt;/span&gt; &lt;span class="variable"&gt;name:&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;param-name&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;desc&lt;/span&gt;) ...
               (&lt;span class="variable"&gt;comment&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;_&lt;/span&gt; ...))
     (&lt;span class="variable"&gt;make-function&lt;/span&gt; &lt;span class="variable"&gt;name&lt;/span&gt; (&lt;span class="builtin"&gt;list&lt;/span&gt; &lt;span class="variable"&gt;param-name&lt;/span&gt; ...))]))

(&lt;span class="builtin"&gt;map&lt;/span&gt; &lt;span class="variable"&gt;parse-function&lt;/span&gt; &lt;span class="variable"&gt;functions&lt;/span&gt;)&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;xml-match&lt;/code&gt; macro is a pattern matcher for SXML.  You specify the &amp;ldquo;shape&amp;rdquo; of the SXML, and if the input matches the pattern the following expressions are evaluated:&lt;/p&gt;

&lt;pre&gt;(xml-match value
  [(pattern expression &lt;em&gt;...&lt;/em&gt;)]&lt;em&gt;...&lt;/em&gt;)&lt;/pre&gt;

&lt;p&gt;The simplified form of a pattern is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;(element &lt;em&gt;...&lt;/em&gt;)&lt;/code&gt; matches an element with the given name.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;name: value&lt;/code&gt; matches an attribute with the given name and value.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;,binding&lt;/code&gt; binds the value of &lt;code&gt;binding&lt;/code&gt; to the given name in the scope of the following expressions.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;...&lt;/code&gt; matches zero or more of the preceeding patterns.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In our example the pattern is:&lt;/p&gt;

&lt;div class="scheme"&gt;&lt;pre&gt;     (&lt;span class="variable"&gt;function&lt;/span&gt; &lt;span class="variable"&gt;name:&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;name&lt;/span&gt;
               (&lt;span class="variable"&gt;param&lt;/span&gt; &lt;span class="variable"&gt;name:&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;param-name&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;desc&lt;/span&gt;) ...
               (&lt;span class="variable"&gt;comment&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;_&lt;/span&gt; ...))&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;So we're looking for an element called &lt;code&gt;function&lt;/code&gt; with an attribute called &lt;code&gt;name&lt;/code&gt; the value of which is bound to &lt;code&gt;name&lt;/code&gt;.  Then follows zero or more &lt;code&gt;param&lt;/code&gt; elements,  with attribute &lt;code&gt;name&lt;/code&gt;, the value of which is bound to &lt;code&gt;param-name&lt;/code&gt;. Finally we expect a &lt;code&gt;comment&lt;/code&gt; element which can contain any amount of data.  The use of &lt;code&gt;_&lt;/code&gt; as the binding name is a common convention to indicate data we don't care about but must still match to make our pattern complete.&lt;/p&gt;

&lt;p&gt;I run the code in DrScheme and see the result:&lt;/p&gt;

&lt;div class="scheme"&gt;&lt;em&gt;xml-match: no matching clause found&lt;/em&gt;&lt;/div&gt;

&lt;p&gt;Oops.  So our pattern isn't complete.  We've also seen one flaw of WebIt!: it doesn't give very good error messages.  However we can easily fix this by adding a catch all pattern that raises an error telling us what we failed to match.  The code follows.  Notice that I've also added pretty printing to make the unmatched SXML easier to read.&lt;/p&gt;

&lt;div class="scheme"&gt;&lt;pre&gt;(&lt;span class="keyword"&gt;require&lt;/span&gt; (&lt;span class="variable"&gt;lib&lt;/span&gt; &lt;span class="selfeval"&gt;"pretty.ss"&lt;/span&gt;))

&lt;span class="comment"&gt;;; parse-function : sxml -&amp;gt; function
&lt;/span&gt;(&lt;span class="keyword"&gt;define&lt;/span&gt; (&lt;span class="variable"&gt;parse-function&lt;/span&gt; &lt;span class="variable"&gt;fn&lt;/span&gt;)
  (&lt;span class="variable"&gt;xml-match&lt;/span&gt; &lt;span class="variable"&gt;fn&lt;/span&gt;
    [(&lt;span class="variable"&gt;function&lt;/span&gt; &lt;span class="variable"&gt;name:&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;name&lt;/span&gt;
               (&lt;span class="variable"&gt;param&lt;/span&gt; &lt;span class="variable"&gt;name:&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;param-name&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;desc&lt;/span&gt;) ...
               (&lt;span class="variable"&gt;comment&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;_&lt;/span&gt; ...))
     (&lt;span class="variable"&gt;make-function&lt;/span&gt; &lt;span class="variable"&gt;name&lt;/span&gt; (&lt;span class="builtin"&gt;list&lt;/span&gt; &lt;span class="variable"&gt;param-name&lt;/span&gt; ...))]
    [&lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;err&lt;/span&gt; (&lt;span class="keyword"&gt;let&lt;/span&gt; ([&lt;span class="variable"&gt;op&lt;/span&gt; (&lt;span class="builtin"&gt;open-output-string&lt;/span&gt;)])
            (&lt;span class="variable"&gt;pretty-print&lt;/span&gt; &lt;span class="variable"&gt;err&lt;/span&gt; &lt;span class="variable"&gt;op&lt;/span&gt;)
            (&lt;span class="builtin"&gt;error&lt;/span&gt; (&lt;span class="builtin"&gt;format&lt;/span&gt; &lt;span class="selfeval"&gt;"Didn't match ~n~a~n"&lt;/span&gt; (&lt;span class="builtin"&gt;get-output-string&lt;/span&gt; &lt;span class="variable"&gt;op&lt;/span&gt;))))]))&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Run this code and you'll see the error occurs as we don't allow the description to contain more than one element.  This is easily fixed by extending the pattern to &lt;code&gt;,desc ...&lt;/code&gt;.  The next error is more interesting.  The &lt;code&gt;function&lt;/code&gt; element contains a &lt;code&gt;return&lt;/code&gt; element.  The WebIt! pattern language doesn't allows us to express optional patterns, so we have to duplicate our pattern and include the case of &lt;code&gt;return&lt;/code&gt;.  This also requires we extend the defintion of the &lt;code&gt;function&lt;/code&gt; structure.&lt;/p&gt;

&lt;div class="scheme"&gt;&lt;pre&gt;&lt;span class="comment"&gt;;; struct function : string string (listof string)
&lt;/span&gt;(&lt;span class="keyword"&gt;define-struct&lt;/span&gt; &lt;span class="variable"&gt;function&lt;/span&gt; (&lt;span class="variable"&gt;name&lt;/span&gt; &lt;span class="variable"&gt;return&lt;/span&gt; &lt;span class="variable"&gt;params&lt;/span&gt;))

&lt;span class="comment"&gt;;; parse-function : sxml -&amp;gt; function
&lt;/span&gt;(&lt;span class="keyword"&gt;define&lt;/span&gt; (&lt;span class="variable"&gt;parse-function&lt;/span&gt; &lt;span class="variable"&gt;fn&lt;/span&gt;)
  (&lt;span class="variable"&gt;xml-match&lt;/span&gt; &lt;span class="variable"&gt;fn&lt;/span&gt;
    [(&lt;span class="variable"&gt;function&lt;/span&gt; &lt;span class="variable"&gt;name:&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;name&lt;/span&gt;
               (&lt;span class="variable"&gt;param&lt;/span&gt; &lt;span class="variable"&gt;name:&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;param-name&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;desc&lt;/span&gt; ...) ...
               (&lt;span class="variable"&gt;comment&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;_&lt;/span&gt; ...))
     (&lt;span class="variable"&gt;make-function&lt;/span&gt; &lt;span class="variable"&gt;name&lt;/span&gt; &lt;span class="selfeval"&gt;"void"&lt;/span&gt; (&lt;span class="builtin"&gt;list&lt;/span&gt; &lt;span class="variable"&gt;param-name&lt;/span&gt; ...))]
    [(&lt;span class="variable"&gt;function&lt;/span&gt; &lt;span class="variable"&gt;name:&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;name&lt;/span&gt;
               (&lt;span class="variable"&gt;return&lt;/span&gt; &lt;span class="variable"&gt;type:&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;type&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;return-desc&lt;/span&gt; ...)
               (&lt;span class="variable"&gt;param&lt;/span&gt; &lt;span class="variable"&gt;name:&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;param-name&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;desc&lt;/span&gt; ...) ...
               (&lt;span class="variable"&gt;comment&lt;/span&gt; &lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;_&lt;/span&gt; ...))
     (&lt;span class="variable"&gt;make-function&lt;/span&gt; &lt;span class="variable"&gt;name&lt;/span&gt; &lt;span class="variable"&gt;type&lt;/span&gt; (&lt;span class="builtin"&gt;list&lt;/span&gt; &lt;span class="variable"&gt;param-name&lt;/span&gt; ...))]
    [&lt;span class="keyword"&gt;,&lt;/span&gt;&lt;span class="variable"&gt;err&lt;/span&gt; (&lt;span class="keyword"&gt;let&lt;/span&gt; ([&lt;span class="variable"&gt;op&lt;/span&gt; (&lt;span class="builtin"&gt;open-output-string&lt;/span&gt;)])
            (&lt;span class="variable"&gt;pretty-print&lt;/span&gt; &lt;span class="variable"&gt;err&lt;/span&gt; &lt;span class="variable"&gt;op&lt;/span&gt;)
            (&lt;span class="builtin"&gt;error&lt;/span&gt; (&lt;span class="builtin"&gt;format&lt;/span&gt; &lt;span class="selfeval"&gt;"Didn't match ~n~a~n"&lt;/span&gt; (&lt;span class="builtin"&gt;get-output-string&lt;/span&gt; &lt;span class="variable"&gt;op&lt;/span&gt;))))]))
&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This works!  This is as far as I want to go in this article.  We've seen how we can use SSAX. SXPath, and WebIt! to create XML transforms in pure Scheme.  There is a lot more to all of these packages but what we've used is sufficient for many uses.  The rest of the code to create Scheme from the API is quite straightforward and specific to Selenium.  If you're curious read the source of the Selenium PLaneT package, which will be released soon.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This post also appears on &lt;a href="http://www.untyped.com/untyping"&gt;Untyping&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-1965802899884148737?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/1965802899884148737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=1965802899884148737' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1965802899884148737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1965802899884148737'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/05/xml-transformation-in-scheme.html' title='XML Transformation in Scheme'/><author><name>Noel</name><uri>http://www.blogger.com/profile/09666551093622614632</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2080885971644496896.post-1468522807904906482</id><published>2007-05-03T17:35:00.000-04:00</published><updated>2007-05-08T14:11:13.989-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='macros'/><title type='text'>Macros Matter</title><content type='html'>Thank you Jens for setting up this Blog. &lt;br/&gt;&lt;br/&gt;

PLT Scheme is a 12-year old project now and it is definitely time to open it up to the world. The language and the project has contributed numerous ideas and products to the world. This covers programming languages (units, mixins, an implementation of cml-style concurrency, etc); programming tools (drscheme, check-syntax, transparent repls, module browsers, etc), programming pedagogy (htdp, htdc); program engineering (we resurrected the "expression" problem, web programming and continuations); and some more. &lt;br/&gt;&lt;br/&gt;

Time and again, people have asked me what I consider the one 'feature' that distinguishes us from the rest of the hordes of programming languages. I always respond with a single word: &lt;br/&gt;&lt;br/&gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;macros.&lt;br/&gt;&lt;br/&gt;

We have pushed macros hard, and we have accomplished a lot with them. I conjecture that without macros, we would never have achieved the level of productivity that this group displays.&lt;br/&gt;&lt;br/&gt;

Of course, everyone else in academia works on types. ML's module type system of the third kind and Haskell's system-complete type system are serious challenges to anyone.  It is probably true that you shouldn't consider yourself a programmer if you can't read and write some of those type-laden programs, and I seriously believe that they are the next generation of influential languages. &lt;br/&gt;&lt;br/&gt;

For the generation-after-the-next then, I see "macros" as one of the big topics (next to concurrency). A real programmer will have to know how Lisp and Scheme-style macros can reduce labor by orders of magnitude, how macros provide the tools for creating the "ultimate abstraction" in the form of domain-specific and embedded languages (Hudak's words). And there is no better place to start with than PLT Scheme's macro system.&lt;br/&gt;&lt;br/&gt;

So I would like to dedicate this blog to all things macros and everything else that matters in (and to) PLT Scheme.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2080885971644496896-1468522807904906482?l=blog.racket-lang.org' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.racket-lang.org/feeds/1468522807904906482/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2080885971644496896&amp;postID=1468522807904906482' title='16 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1468522807904906482'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2080885971644496896/posts/default/1468522807904906482'/><link rel='alternate' type='text/html' href='http://blog.racket-lang.org/2007/05/macros-matter.html' title='Macros Matter'/><author><name>matthias</name><uri>http://www.blogger.com/profile/00000181081270224360</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://www.ccs.neu.edu/home/matthias/Images/felleisen1.jpg'/></author><thr:total>16</thr:total></entry></feed>
