MacLispix has a built in text editor for reading .lisp and other text files. It can also read the .html files, but the various tags are a source of clutter, so reading the .html files that way rather than with a Browser is a last resort.

(Home)

Getting around in the LISP text editor

+ To see the headings in the file:  command-0 (apple-zero), or DBMac - Print name - •••• command.
+ The page up and page down keys work.
+ To search for a word:  command-F
+ To see other doc files:  File - MLx Open - Docs command
+ To wrap text to your window:  select text, option-Q
+ To resize window:  click on zoom box, upper right
+ To find a window covered by others:  Windows or W menus.
+ To push a window to the back:  option-command-click on title bar.
+ To see a test file given its path (eg:  "my disk:my folder;my file.txt"),
  highlight the path and press command-D, or use the file - open selection...
  menu.
+ To see a list of function definitions, use the tools - list definitions menu.
                apple-L  Moves the Listener window to the front.~%~
                    (the bottom line of listener window always indicates busy or idle).~%~
                apple-.  Halt anything. Return from break level.~%~
                apple-e    eval selection (doit:  compile, edit, etc.)~%~
                apple-W  Erase front window (text, images, labels. Clears Listener).~%~
                apple-P  Print name of front text (FRED) window in Listener.~%~%~
                option-apple-[click on title bar]   Pushes window to bottom.~%~
                option-. (with insertion bar on either side of name) - gets source code.~%~
                option-apple-click (on name) - gets source code.~%~
                option-Q   Fill (or wrap) selected text in a text window.~%~%~
                control (& move with mouse button down) - moves images from any position.

                apple-U - makes highlighted text bold
                apple-J - puts highlighted text into italics
                apple-I - lists the image arrays in the Listener.

Functions

The optional message dialog, which appears when using most of the menus or buttons. These give instructions or information about that menu item, and can be shown by holding the option key down when selecting any menu item.

The function name is useful for getting the function name that implements the menu, and then getting the source code or function documentation: The DBMac - apropos menu item is used to access function names and documentation, and to print them in the listener window. A fragment (without wild cards or spaces) of the function name is typed in the apropos dialog, and then the desired function is selected from the list. If you have not deleted the source files that came with MacLispix, then command- option-click ‘ing on the function name in the listener window (or any other FRED window) will bring up the source code for the function in a new FRED window.

The documentation that goes along with a function can be accessed with the apropos menu item as above, or by looking at the source code. The source code might also have helpful comment statements, for example:

(defun a_particular_function (a b c) “This is the documentation for the function.” (+ a b (1- c)))

Function definitions look like this:

(defun square (num) "This is the documentation for the 'square' function. It returns the number times itself." (if (numberp num) ;--> tests the argument (* num num) ;--> the answer, if the argument was a number (complex even!) "I didn't get a number.")) ;--> what is returned if the argument was not a number.

This is not defined in MacLispix, so the definition has to be evaluated (that is, the function has to be compiled) before using it. To do this, double click just to the left of the first parenthesis {just to the left of '(defun ' } to select the function definition, then press cmd-E to evaluate it.

Typical output from running this function: ? (square 4) ;--> what you type in the Listener window (the question mark is the LISP prompt) 16 ;--> what LISP types back. ? (square (sqrt -2)) #c(-2.0000000000000004 0.0) ;--> this is a complex number.

Here are some LISP expressions that do something. To evaluate them (or to try them out), select them and use cmd-E (or apple-E), or the Eval - Eval Selection menu. They can be selected by dragging over them with the mouse (button down), or double clicking on either side of them.

(pop_listener_window) ;--> brings the Listener to the front. Note - the sides of this expression are ;^ here and here ^, because anything to the right of a semicolon is a comment.

(sqrt (+ (* 3 3) (* 4 4))) ;--> Note - results appear in the Listener window.

You can have any number of FRED windows open at a time. You can use the Windows menu to bring any of them to the front. Cmd-option-clicking on the title bar will push the window to the bottom, probably hiding it.

Selecting this expression and evaluating it will display a scale. I might put drawings in the MLx documentation in this way.

(make_x_axis_window 410 '(0 410))

This long skinny window can be moved using the mouse. It can be closed with cmd-W if it is the front window, or with the DBMac - windows - clear by title menu.

--- A note about my MacLispix menu style ---

Most menu items call a function with 'menu' as part of the last name. All this function does, is bring up a help dialog, and then call the function that does the work, or a function that inputs some parameters, and then in turn calls a function that does the work. The 'menu' part of the name is not required by LISP, but is there just to make clear what that function is for.

The menu items usually invoke the function using eval-enqueue. This little bit of added complexity results in the function being invoked at the level that it would have been had it been typed in the Listener. This level usually allows the function to be interruped, or to work in the background. If functions are invoked directly by the menu, they have a higher priority, and cannot be moved to the background, say, by clicking on a window. In other words, most time consuming MacLispix functions can be run in the background - you can edit files, look at images, etc. while it is working. {This is NOT true if the thermometer is showing. This again is just a matter of style, and I can deactivate the thermometer for specific functions if you wish.}

MacLispix has good searching facilities. Use {Tools - MLx search files} to search text files or source code files for strings or words. Use {Tools - MLx apropos} to see the function names that MacLispix knows about.