24 Nov 2008

Simple GnuPLoTting

posted by vyzo

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

A new package, gnuplot.plt, 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.

Without further ado, here is to every computer scientist’s favorite growth curves:

(require (planet vyzo/gnuplot))
(define gplot (gnuplot-spawn))
(define data 
   (build-list 90
     (lambda (x) 
       (let ((x (add1 (/ x 10.))))
         (list x (log x) (* x (log x)) (expt x 2) (expt 2 x)))))))
;; png output options
(define png '(png enhanced transparent font (str arial)))
;; on screen plot
(gnuplot-set gplot '(title (str "growth curves")))
(gnuplot-plot gplot 
  #:range '(() (1 1000))
  (gnuplot-item data '(using (seq: 1 1) title (str "x") with line))
  (gnuplot-item data '(using (seq: 1 2) title (str "log(x)") with line))
  (gnuplot-item data '(using (seq: 1 3) title (str "xlog(x)") with line))
  (gnuplot-item data '(using (seq: 1 4) title (str "x^2") with line))
  (gnuplot-item data '(using (seq: 1 5) title (str "2^x") with line)))
;; replot to png
(gnuplot-hardcopy gplot "/tmp/grow.png" #:term png)
;; redo with logscale
(gnuplot-set gplot '(logscale y))
(gnuplot-replot gplot)
(gnuplot-hardcopy gplot "/tmp/loggrow.png" #:term png)
more →

21 Nov 2008

PLT Scheme v4.1.3

posted by Eli Barzilay

PLT Scheme version 4.1.3 is now available from http://plt-scheme.org/ This is a bug-fix release.

Notable changes:

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

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

Feedback Welcome.

more →

28 Oct 2008

PLT Scheme v4.1.2

posted by Eli Barzilay

PLT Scheme version 4.1.2 is now available from http://plt-scheme.org/ This is a bug-fix release.

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

Feedback Welcome.

more →

06 Oct 2008

Web Application Development in PLT Scheme

posted by Jay McCarthy

Many users often post to the plt-scheme 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: Jens Axel Soegaard and David Reynolds, we’ve written a tutorial with Danny Yoo.

The tutorial is available at http://docs.plt-scheme.org/continue/index.html. 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 fast start servlet setup based on the Instaservlet package from Untyped.

Please take a look and pass along this as a pointer to those who may be interested in PLT Scheme.

more →

05 Oct 2008

PLT Scheme v4.1.1

posted by Eli Barzilay

PLT Scheme version 4.1.1 is now available from http://plt-scheme.org/Notable changes:

  • web-server: New servlet development tutorial; quick launching of servlets from DrScheme via the `web-server/insta’ language; new form abstraction through formlets.

  • 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.[Note that mirror sites can take a while to catch up with the new downloads.]

Feedback Welcome.

more →

12 Aug 2008

PLT Scheme v4.1

posted by Eli Barzilay

PLT Scheme version 4.1 is now available from http://plt-scheme.org/

  • DrScheme changes:
    • The Module language now has an automatically inserted #lang declaration, so the interactions window is available right away for new windows.
    • Searching is now interactive (see the manual for details).
    • Memory limits are now enabled by default.
  • Typed Scheme supports a novel type checking mechanism for homogeneous and heterogeneous variable-arity function definitions and applications.

  • Redex (a domain-specific language for testing operational semantics) is now included in the distribution. See also [redex.plt-scheme.org](http://redex.plt-scheme.org/).

  • Lots of improvement to the documentation, including: better searching, table-of-contents, and language-sensitive help (in the teaching languages).

  • The world.ss teachpack no longer supports end-of-time, only stop-when.

  • MzScheme has now a logging facility, search the documentationfor “logger” for more details.

  • Bug fixes:
    • begin in R5RS (and derived languages),
    • #lang planet,
    • eval works with phases.

Feedback Welcome.

more →

29 Jul 2008

Search in DrScheme

posted by Robby Findler

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.

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

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.

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?

more →

04 Jul 2008

PLT Scheme v4.0.2

posted by Eli Barzilay

PLT Scheme version 4.0.2 is now available from

http://plt-scheme.org/ 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 to minimize confusion. ]

Feedback Welcome.

more →

22 Jun 2008

PLT Scheme v4.0.1

posted by Eli Barzilay

PLT Scheme version 4.0.1 is now available from


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.

more →

12 Jun 2008

PLT Scheme v4.0

posted by Eli Barzilay

PLT Scheme version 4.0 is now available from [http://plt-scheme.org/](http://plt-scheme.org/) This major new release offers many improvements over version 372, and we encourage everyone to upgrade.

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

  • The documentation has been re-organized and re-written. New tutorials and overviews offer a clearer introduction to Scheme and PLT Scheme.

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

  • R6RS programs are supported in two ways: though the plt-r6rs executable and through the #!r6rs prefix. The latter allows an R6RS library or program to serve as a PLT Scheme module.

  • Legacy R5RS support is improved, partly through a separate plt-r5rs executable.

  • 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 “Getting rid of set-car! and set-cdr!

  • ProfessorJ uses a new and improved parser, it evaluates programs faster, and it includes a Java-specific indenter.

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

  • 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 Typed Scheme page.

Feedback Welcome.

more →

Made with Frog, a static-blog generator written in Racket.
Source code for this blog.