Exercises in this lecture              Go to the slide, where this exercise belongs -- Keyboard shortcut: 'u'  

Exercise 2.1
Getting started with Scheme and LAML *

The purpose of this exercises is learn the most important practical details of using a Scheme system on Unix. In case you insist to use Windows we will assume that you install the necessary software in your spare time. There is no time available to do that during the course exercises. Further details on installation of Scheme and LAML on Windows.

You will have to choose between DrScheme and MzScheme.

DrScheme is a user friendly environment for creating and running Scheme programs, with lots of menus and lots of help. However, it is somewhat awkward to use DrScheme with LAML. Only use DrScheme in this course if you cannot use Emacs, or if you are afraid of textually, command based tools. Follow this link for further details.

MzScheme is the underlying engine of DrScheme. MzScheme is a simple read-eval-print loop, which let you enter an expression, evaluate and print the result. MzScheme is not very good for debugging and error tracing. MzScheme works well together with Emacs, and there is a nice connection between MzScheme and LAML. MzScheme used with Emacs is preferred on this course. Please go through the following steps:

  1. Insert the following line in your .emacs file in your home dir, and then restart Emacs:

      (load "/pack/laml/emacs-support/dot-emacs-contribution.el")

  2. Have a session with a naked Scheme system by issuing the following command in Emacs: M-x run-scheme-interactively

    • Define a couple of simple functions ( odd and even, for instance) and call them.

    • Split the window in two parts with C-x 2 and make a buffer in the topmost one named sources.scm ( C-x b ). Bring the Scheme interpreter started above into the lower part of the window. The buffer with the Scheme process is called *inferior-lisp*. Put the sources.scm buffer in Scheme mode ( M-x scheme-mode ). Define the functions odd and even in the buffer and use the Scheme menu (or the keyboard shortcuts) to define them in the running Scheme process.

  3. Have a similar session with a Scheme+LAML system by issuing the following command in Emacs: M-x run-laml-interactively (You may have to confirm that a previously started Scheme process is allowed to be killed).

    • All you did in item 2 can also be done here.

    • Evaluate a simple HTML expression, such as

            (html (head (title "A title")) (body (p "A body")))

    • Use the function xml-render to make a textual rendering of the HTML expression.

    • Make a deliberate grammatical error in the LAML expression and find out what happens.

  4. Make a file 'try.laml'.

    • Control that Emacs brings the buffer in Laml mode. Issue a M-x laml-mode explicitly, if necessary.

    • Use the menu 'Laml > Insert LAML template' to insert an XHTML template.

    • Fill in some details in the head and body.

    • Process the file via the LAML menu in Emacs: Process asynchronously. The file try.html will be defined.

    • Play with simple changes to the HTML expression, and re-process. You can just hit C-o on the keyboard for processing.

    • You can get good inspiration from the tutorial Getting started with LAML at this point.

There is no solution to this exercise