Terrapin Resources

Terrapin Logo 4 has been discontinued! Our new Terrapin Logo version is much more powerful and modern; we strongly recommend that you update to our latest release of the Logo programming language.

The Workspace

All kinds of commands related to the workspace.

ABOUT

User-supplied procedure to display an About box.

Syntax

Description

In the Help menu, Logo displays a menu item About this program…, which is usually grayed out and disabled. If you, however, write a procedure ABOUT that for example displays an alert with information about your Logo program, the menu item is enabled, and clicking that menu item runs your ABOUT procedure.

This is a convenient way to display information about your program, especially if you deliver your programs as a binary Logo package. See the Logo Packages page for details about packaging your Logo programs.

ALIAS

Defines alias names.

Syntax

Description

ALIAS defines a new procedure name with the same meaning as an existing procedure name. The new name is an alias name for the existing name and behaves exactly like that name. Values or properties stored at a name are not aliased.

ALIAS is handy for defining shortcuts or translations of commands.

ASCII

Converts a character into its ASCII value.

Syntax

Description

ASCII reports the American Standard Code for Information Interchange (ASCII) value of its input. The American Standard Code for Information Interchange (ASCII) is a standard code for representing numbers, letters and symbols. If its input is a word, ASCII reports the ASCII value of the first character in the word. ASCII reports an integer between 0 and

  1. The input must contain at least one character. The character can be a letter, number or special character. To output the character corresponding to an ASCII code input, use CHAR.

Example

ASCII “A Result: 65

BYE

Also: QUIT,EXIT

Ends Logo.

Syntax

Description

BYE saves the Logo workspace and all open graphics windows and returns to the operating system. The command names QUIT and EXIT perform the same function.

CHAR

Converts a number into a Unicode character.

Syntax

Description

CHAR reports the character whose ASCII code is the input. The input number can be from 0 through 255. To output the ASCII code corresponding to an input character, use ASCII.

Use caution when saving a Logo name or procedure that contains unprintable characters, like characters with a value of less than 32. Logo saves them as-is without escaping them. If you, for example, save a value that contains a newline character (CHAR 10), then Logo may not be able to read that file correctly.

Example

CHAR 65 Result: A

CLEARTEXT

Also: CT

Clears the Listener panel.

Syntax

Description

CLEARTEXT clears all text and places the cursor in the upper left corner of the Listener panel. CLEARTEXT is the same as the command TYPE CHAR 12.

Example

REPEAT 5 [PR [GOOD EVENING]] CLEARTEXT

DATE

Reports the date.

Syntax

Description

DATE reports the current date as a four-element list in the form [day month year dayofweek]. The dayofweek is a number from 1 to 7, starting at Sunday.

Example

DATE Result: [20 1 2014]

FULLSCREEN

Also: FS

Switches to the Full Screen perspective.

Syntax

Description

FULLSCREEN maximizes the current Graphics window, thus hiding all other windows. See also SPLITSCREEN and TEXTSCREEN.

Example

FS

HELP

Displays help for a command.

Syntax

Description

HELP displays the help file for the requested command in the Help window.

Example

HELP “FORWARD

LOAD

Loads a file into Logo.

Syntax

Description

LOAD transfers the contents of the file specified by its input from the disk to the workspace. The entire file is treated as though it were typed from the keyboard. LOAD throws an error if the file is not successfully loaded. LOAD can load binary workspaces as well as ASCII files containing Logo commands. If you want LOAD to display the name of Logo procedures as they are defined, set the VERBOSE property of the built-in :PREFS object to TRUE.

Note that the file still exists on the disk; only a copy of it has been transferred to the workspace.

If no file name extension is specified, LOAD loads the file filename.LGO. To load a file that has no extension, a period is necessary after the filename. Binary workspaces have the extension .BIN.

LOAD is also capable of displaying a standard file open/save dialog box. In order to open a dialog box instead of a file, the file name contains a list of file type descriptors. A file type descriptor is a file type, optionally followed by an “=” and a description. The text “lgo=Logo source file” would be a valid file type descriptor for all files ending with “.LGO”. More than one file descriptor may be supplied; in this case, separate the descriptors with commas. The file open/save dialog would display all files ending with the given file type. A Windows dialog would also display the description of the file types, while a Macintosh dialog would display the matching files only. The Logo command LOAD ‘lgo=Logo source file,txt=Text file’ would, for example, display all files ending with .LGO or .TXT.

If you use “*” as a file type, the file open/save dialog displays all available files. This is done differently on Windows and Macintosh. A Windows dialog would initially display all files with the first type, and offer all additional file types as choices. The Macintosh dialog would always display all files matching all file types.

If you use the empty word or the empty list as a file name, Logo automatically opens a file open/save dialog displaying all available files.

Clicking the Cancel button in a file open/save dialog cancels the execution of the LOAD command.

See also LOADPIC, SAVE, and SAVEPIC.

MAKE

Assigns a value to a name.

Syntax

Description

MAKE defines a variable using the name of the first input and assigns the second input as the value of that variable. Once you have created the variable, you may obtain its contents by using :name. Think of the colon (:) as the value of name. To keep a variable local to the procedure in which MAKE is used, see LOCAL. Remember that all local names of a procedure are visible to any procedure; a MAKE command may, therefore, set a name that is local to a procedure that is calling the current procedure if you use MAKE inside a procedure. See also NAME and THING.

Example

MAKE “NUMBER 73 :NUMBER Result: 73

MILLISECONDS

Outputs the number of milliseconds spent since January 1, 1970.

Syntax

Description

MILLISECONDS outputs the number of milliseconds spent since January 1,

  1. MILLISECONDS can be used to track executions times. The accuracy of this timer is not perfect, but depends on the operating system.

NAME

Assigns a value to a name.

Syntax

Description

NAME defines a variable by assigning the value of the first input to the name of the second input. Once you have created the variable, you may obtain its contents by using :name. Think of the colon (:) as the value of name. NAME is equivalent to MAKE except that inputs are in reverse order. See also LOCAL.

QUOTE

Quotes its input.

Syntax

Description

QUOTE quotes its input. Lists are returned unchanged.

Example

MAKE “FIRSTNAME “JOHN :FIRSTNAME Result: JOHN QUOTE :FIRSTNAME Result: “JOHN

RECYCLE

Starts the garbage collector.

Syntax

Description

RECYCLE starts the Logo garbage collector. All elements are scanned, and elements which are not needed any more are freed. The result is the number of available nodes. If TRUE is given as an optional input, RECYCLE prints some information about its work. Normally, Logo starts the garbage collector whenever it detects that it would run out of elements. This might be a lengthy operation, so RECYCLE is provided to start the garbage collector at a user-defined time. The number of free nodes reported is a snapshot of the current memory usage; if Logo runs out of memory, it simply allocates more memory from the operating system.

Example

(RECYCLE TRUE)

RESTART

Erases everything and restarts Logo.

Syntax

Description

RESTART erases all Logo contents and reinitializes Logo. When RESTART is used, a confirming dialog box appears. If RESTART and its optional argument TRUE are enclosed in parentheses, Logo will be restarted without the appearance of the confirming dialog.

Note that, although Logo erases the entire workspace, the file Init.logo is not reloaded.

SAVE

Saves the workspace to disk.

Syntax

Description

SAVE saves the contents of the workspace to a file on the disk. This includes all defined procedures and names. Workspace files are saved as text files unless otherwise specified.

If no file name extension is specified, SAVE saves the file with the name filename.LGO. To save a file that has no extension, a period is necessary after the filename.

If TRUE is given as a second input, SAVE saves the workspace as a binary file. This file cannot be read by humans.

SAVE is also capable of displaying a standard file open/save dialog box. In order to open a dialog box instead of a file, the file name contains a list of file type descriptors. A file type descriptor is a file type, optionally followed by an “=” and a description. The text “lgo=Logo source file” would be a valid file type descriptor for all files ending with “.LGO”. More than one file descriptor may be supplied; in this case, separate the descriptors with commas. The file open/save dialog would display all files ending with the given file type. A Windows dialog would also display the description of the file types, while a Macintosh dialog would display the matching files only. The Logo command SAVE “|LGO=Logo source files,bin=Binary workspaces| would, for example, display all files ending with .LGO or .BIN.

If you use “*” as a file type, the file open/save dialog displays all available files. This is done differently on Windows and the Macintosh. A Windows dialog would initially display all files with the first type, and offer all additional file types as choices. The Macintosh dialog would always display all files matching all file types.

If you use the empty word or the empty list as a file name, or if you omit the file name, Logo automatically opens a file open/save dialog displaying all LGO and BIN files.

Clicking the Cancel button in a file open/save dialog cancels the execution of the SAVE command.

See also LOAD, LOADPIC, and SAVEPIC.

SPLITSCREEN

Also: SS

Switches to the Split Screen perspective.

Syntax

Description

SPLITSCREEN switches the Logo environment to the Split Screen perspective. Usually, the Split Screen perspective only displays the Listener and Graphics windows, but the user can change the layout of all windows freely.

See also TEXTSCREEN and FULLSCREEN.

Example

SS

TEXTSCREEN

Also: TS

Switches to the Text Screen perspective.

Syntax

Description

TEXTSCREEN switches the Logo environment to the Text Screen perspective. Usually, the Text Screen perspective only displays a maximized Listener window, but the user can change the layout of all windows freely.

See also SPLITSCREEN and FULLSCREEN.

Example

TS

THING

Reports the value of a name.

Syntax

Description

THING reports the value associated with the variable named in the input. THING is the Logo primitive that does the same job as : (dots). It can be used to give a variable a second level of evaluation. A variable name could, for example, be passed in to a procedure, and the procedure obtains its value with the THING command. Remember that Logo makes all names in a procedure visible to a procedure that this procedure calls. Therefore, getting a value may result in getting the value of a name that is local to a calling procedure.

Example

MAKE “COLOR “BLUE MAKE “BLUE “AQUAMARINE THING “COLOR Result: BLUE THING :COLOR Result: AQUAMARINE THING “BLUE Result: AQUAMARINE THING :BLUE :AQUMARINE is not a name

TIME

Outputs the time.

Syntax

Description

TIME reports the current time as a list of three numbers in the form [hour minute second]. The hours are in 24-hour format. See also DATE.

Example

TIME Result: [10 35 50]

VERINFO

Outputs Logo version information as a list.

Syntax

Description

VERINFO reports information about the version of Logo that is currently running as a list. The elements are major version number, minor version number, subrelease number, the name of the Logo program, the build date as a string, and the name of the operating system.

VERINFO is available from Terrapin Logo version 4.1 on.

Example

VERINFO Result: [4 1 0 Terrapin Logo Thu Jul 16 10:22:38 2015 Windows 8.1 (64 bit)]

VERSION

Also: VER

Outputs the Logo version.

Syntax

Description

VERSION reports information about the version of Logo that is currently running.

Example

VERSION Result: Version 4.0 Tue Jan 14 20:52:26 2014 Windows 8.1 (64 bit)

WORKSPACE.VIEW

Switches to the Work perspective.

Syntax

Description

WORKSPACE.VIEW causes the Workspace View dialog to appear. The Workspace View dialog contains information about the current contents of the Logo workspace.

WORKSPACE.VIEW is equivalent to clicking the Workspace View button .

Example

WORKSPACE.VIEW