Quick look on WINSCM


Some people have asked me to translate the help... I have no time to translate the help in the software (this is even not uptodate in french , the current one was for the first version...) but I chose to translate this quick introduction... I am sorry for my poor english and the clumsy translation (sorry I do not "translate" the figures).

This document is a quick presentation ofWinscm through a working session example. It is the text given to our students when they discover this programming environment. It is not an exhaustive user's guide which presents all the possibilities of the software, some are even not raised (projects for example). However, the following should be enough for discovering Winscm even for absolute beginners.

This text constitutes as well a part of the annex of the book "Débuter la programmation avec Scheme"published by ITP France.

Structure of document


Click here to download the software

Starting with Winscm
The Winscm window
Basic actions
The interpreter in the environment
Working session example

Starting with Winscm

With the explorer, select the directory containing the Winscm software and double-click on the icon titled Winscm. An advertising window appears. A brief moment later, the interpreter window opens then the Winscm window too.

The Winscm wincow

The Winscm window have some components you can find in most of MS-Windows applications (FIG 1): a title bar, a system menu, maximize and minimize buttons, tool bar (buttons with most current actions), scrollbars (to scroll text when it is longer than the size of the window)...

FIG 1 - The main window of Winscm and its major compnents
Some other elements are particular to our application:
You can select a window simply by clicking on it.

A contextual menu can be open by right-clicking the mouse. This menu depends on the window where was the cursor at clicking.

Basic actions
Using menus

To activate a menu, you have two solutions:

Then you can chose the command you want by using the mouse or the arrow keys. Note that each time a command is selected, a description of the action appears in the status bar (bottom-left of the window).
Quit Winscm

the sotware... Many solutions, you just have to chose. Each time you are asked for a confirmation. If a file (a "program") is edited and has been modified since last save, you are offered to save it.
Calling help

You can get help (sorry in french...) either through Help menu, or by clicking the button with a question mark, or by pressinf the F1 key (in this case you have a contextual help: it depends on the current situation when you press the key).

Some useful commands for edition.
Other commands
The interpreter in the environment

In this window, and only in this one, you can evaluate expressions: it is the window of the language, other windows are only for edition.

The interpreter took place in the Winscm window. You can display it in full screen by pressing simultaneously the Alt and Enter keys (when this window is active). You go back in the same way.

Working session example.

This example will illustrate, among other things, the links between the edit area and the interpreter area. We will discover too the main fonctionnalities of the software. You may have more information by reading the help (in french).

Open a file

In this session, we will work with a still begun program. Therefore we first have to open the file containing this program. This can be done by activating the command Open of the File menu, or by clicking on the button with an open folder on it, or else by activating the contextual menu of the variables area and chosing open.

Then a window opens, which asks you to chose your file (FIG 2). The one we are interested in is in the c:\winscm95\travail directory. Its name is exemple1.scm.

FIG 2 - Window for chosing of file to open

Then, you have to select the right directory in the directory area, then to double-click on the program name in the program names area. Then the file opens. You can see the list of defined objects which appears in the variables area.

Access to code

By clicking on one of the name (we should say identifier), the text (or code) that defines it appears in the edit area.

Let us click on the identifier cub (FIG 3). Its definition appears in different colors and lines are indented with a convention that will be explained later. The code for color is the following:

FIG 3 - Looking at the code that defines the variable (here function) cub
Definition of a new variable

To define a new variable, you can use two ways:

  • to use the Function menu, then the Add command;
  • in the edit area, to press the right button, the contextual menu appears, then it suffices to select the New Expression command (FIG 4 ).
  • FIG 4 - Definition of a new expression

    The edit window becomes empty; you can now enter the code of the new variable to define. Enter the next code (even if you do not understand it at now - but it should not look so strange...) which defines the new variable carre+1:

    The symbols lambda and define are predefinite one, then they appear in green. carre was defined by user (you) in the current working file (look: it appears in the variables area), then it appears in blue. Others are in black.

    Maybe have you noticed that when you type a closing round bracket, the corresponding opening one flashed (this may be too fast on some PC). Moreover, at the left of the status bar (bottom of main window) appears the beginning of the expression you have finished with this closing brackets. This proves to be necessary when you have imbricated expressions. You will quickly be convinced.

    You probably have noticed too that indentation is automatically performed; its goal is to improve the readibility of programs. You will soon be aware that this is a great help when you have quite long definitions. The indent convention is the following: the sub-expressions of an expression are lined the one under the others (but you have to insert a end of line - Enter key - between each).

    Save work

    There are two different steps. To distinguish them, we will name the first one by ``store'' and the second by ``save''.

    First, we have to do such that the variable will be effectively defined in the file. Store is performed atomatically if the Enter key is pressed after the last bracket of the definition. Anoter solution is to right-click in the edit area and to chose the Store command. A heading appears when the variable is stored if the Heading option of the contextual menu of variables area is activated. It is to facilitate the writing of comments.

    If an error is detected (not every synatx error is) during storage, a warning appears. You can still store the text, the name of the variable appears then in red. It could be corrected later.

    To save the file, you have to use either Save or Save under of File menu, or click on the the button with a disk on it. The Save under command allows you to change the file name (FIG 5).

    FIG 5 - Save of the working file under the namemonfichier.scm

    For example, you can save the current file under the new name (monfichier.scm par exemple). Let us note that the extension ``.scm'' is added by default. The edit window took the name of the file.

    Interaction edit window-interpreter

    It is important to be aware that at now, since no interaction between edition and the interpreter has occured, objects defined in the file we have opened are not known by scheme. To convince you, it suffices to try to evaluate the expression (carre+1 2): an error occurs. This told you that the identifier carre is unknown. Indeed, every variable must be defined in the interperter if you want to evaluate (and then to use) it.

    If you want the variable carre+1 to be known by scheme, you must make scheme evaluate its definition. A way is to select the variable in the variables area, then to activate the contextual menu in the edit area (remember, it is by right-clicking) and then to chose the Evaluate(FIG 6) command. Another way is to click on the button with the balloon. This evaluation is automatically performed when storing if the Auto option of the contextual menu of variables area is activated.

    FIG 6 - Contextual menu of edit area; it allows the evaluation of an expression.

    In each case, we notce that something happens in the interpreter window. Indeed, the code of the definition of carre+ has been transmitted to scheme. This is similar as if the definition (define carre+1 (lambda ... )) had been written in the interpreter window. Then Scheme has evaluated and thus know this identifier, we will check that.

    Let us try to evaluate the expression (carre+1 1) again... Another error occurs~! But this time, this is the carre variable which is unknown. This is indeed used in the definition of carre+1. But, the carre must have been defined -in Scheme- before any use of its identifier. Therefore we have to evaluate the definition of carre too, this can be done in the same way as for carre+1.

    Once it is done, the evaluation of (carre+1 1) is at last possible without error and the result is returned.

    Now if we want to use the variable cube, we should have to redo the same with this variable and so on for each one. This could quickly become tedious. Happily, there is another solution. It consists in to activate the contextual menu of the variables area (FIG 7) and to chose the Evaluate all (as well available in the Functions menu). In this cas, all the variables defined in the file (i.e. whose names appear in the variables area) are evaluated. Therefore they can all be used.

    FIG 7 - Contextual menu of variables area; it allows to evaluate every definition in a single action.

    It is of course possible to write expressions which are not definitions. These expressions appear in the variables area under the names !divers_1, !divers_2, etc. in chronological order of writing. (FIG 8).

    FIG 8 -An expression which is not a definition appears under the name !divers_X

    To evaluate a !divers_1 expression, you have to select the expression in the edit window (by highlighting it) and then to chose evaluate in the contextual menu.

    It is possible to delete an expression by selecting its name and chosing Delet in the contextual menu of the variables area.

    Importing variables

    It happens sometimes that you need a variable you have alreaduy defined in an other file. For example, let us imagine you need the deuxX2+1 variable defined in the file C:\winscm95\travail\exemple2.scm. To rewrite it is a loss of time... To avoid that, it suffices to activate the Insert variable command of the File menu. Then, you just have to chose the file which contains the variables to reuse (for our example it is exemple2.scm), then in the list of variables that appears, you just have to click (once) on each variable, then to open the contextual menu of this window and chose Select. It is as well possible to insert a whole file with the Insert command of File menu (FIG 9).

    FIG 9 - Insertion of variables

    Imported variables appears now in the variables area of exemple1.scm. You now have to evaluate them in order to use them.

    Let us note that it is possible to import a variable directly from another open browser simply by "drag and drop" of its identifier: click (and let the button down) on the name of the variable in the source variables area and move the mouse pointer (still with button down) until the target variables area then release the button.

    Modifying definitions order

    In "text mode", you have to use "cut/paste". In ``browser mode'', you have to select the variable to move, activate contextual menu, chose Move. Then, select the variable before ou after which one you want to move and chose Move Before or Move After (FIG 10). Else, you can chose Cancel Move.

    FIG 10 - Modifying order of variables.
    Leaving an edit window

    To leave an edit window, it suffices to double-click on its close button. Try it. Do you have thought to save it? Happily, if not, a message warned you! In a general way it is a good habit to regularly save your work: an unwilling crash of the computer may happen...

    Save on a floppy disk

    To save on a floppy disk, you must select the Save under command of File menu. And then in the drive area, chose the floppy drive (often its name is A: or B:). And last, give a name to the file in the file name area.

    Restarting the interpreter

    If for some reason, a problem occurs with the interpreter an its window is destroyed or becomes unmanageable, it is possible to restart it by chosing the command File - Reinit Scheme. You will then eventully have the choice between several interpreters, chose one by double clicking on it. (FIG 11).

    FIG 11 - Reinitialisation of interpreter


    Notes :

    There is a small problem with the version under Windows 95 when you close the application : you have to click OK when a message appears. This has no consequence but we cannot solve the trouble. [back]

    To select a piece of text, you must put the cursor at the beginning of the piece, then by holding the left button down, move the cursor until the end of the piece of text and then let the button up (the text is highlighted).[back]


    scheme@lifl.fr: pour plus d'informations.

    routier@lifl.fr