;; (c) Copyright 1983 Massachusetts Institute of Technology ;; ;; Enhancements (c) 1983, Symbolics, Inc. All Rights Reserved. ;; The data and information in the Enhancements is proprietary ;; to, and a valuable trade secret of, SYMBOLICS, INC., a ;; Delaware corporation. It is given in confidence by ;; SYMBOLICS, and may not be used as the basis of manufacture, ;; or be reproduced or copied, or distributed to any other ;; party, in whole or in part, without the prior written ;; consent of SYMBOLICS. ;; (SETQ $LOADPRINT NIL) ;This shouldn't be needed any more --kmp ;(COND ((STATUS FEATURE MACLISP) (LOAD '((LISP)DEFMAX)))) (DEFSCRIPT $CONSOLEPRIMER "Welcome to the MACSYMA Primer. This section of the Primer is called the CONSOLEPRIMER because it is intended to be used by people who have not had previous experience interacting with a computer console." (COND ((AND $PAGEPAUSE CURSORPOS)(SCRIPT 'CRTCONSOLE NIL))) (SLEEP 2) "You will notice that your console looks much like a typewriter, except for having a few special keys. The two most important special keys are the 'altmode' and the 'control' key. The 'altmode' may be labeled 'alt', 'esc', '(sel)', or 'escape'. The 'control' key may be labeled 'CTRL' or 'CNTL'. The altmode is used to enter the MACSYMA editor. Do not attempt to use the editor while you are in the Primer since it may tend to confuse you. A future script will deal with editing. The control key is used in the same fashion as the shift key on the typwriter, i.e. you hold it down and type the character whose 'control' value you wish. For example, to type control-Z, you would hold down the control key and type a Z. Don't do that now, as control-Z is the control character that will return you to top level when you are ready to log out." (SLEEP 2) "The Primer will explain some of the aspects of MACSYMA to you and allow you to try out various examples. Your responses to the Primer must end with a semi-colon (;). That is the one thing which the Primer cannot correct you on, since it will not even see your response until you have typed the semi-colon. Thus if nothing seems to be happening, check that you have typed the semi-colon." "In the Primer you should answer all questions the system asks. There are three kinds of questions:" "1. Questions you can answer with a yes or a no. You type the word YES or the word NO followed immediately by a semi-colon (;) to answer these. Case does not matter, upper or lower will do. Try it here: Type YES; or NO;" (AND (YESORNO) (TERPRI)) "2. Questions which require you to select a script or an option. The system will print out a list, for example:" (MENU '($SIMPLIFICATION $SCRATCHPAD $ASSIGNMENT)) "This list is called the 'menu', the list of scripts available. You select a script to see by typing the number of your choice followed by a semi-colon (;), to answer these. E.g." "3;" "Now you try it." (MENU '($SIMPLIFICATION $SCRATCHPAD $ASSIGNMENT)) (NUMCHK 3) "3. Requests to type in commands to MACSYMA. The system will make a request, such as 'Type in a polynomial in X,' and then give you a dummy MACSYMA command line number. You then type the command, followed by a semi-colon. This is to give you a chance to practice what you are learning. If you type the command correctly, the system will pass what you type to MACSYMA, and MACSYMA will evaluate it and return a response. If you make a mistake the system will attempt to tell you what you did wrong, and will offer you a chance to try again. Here, try typing X+2;" (INCHK '((MPLUS) $X 2)) "The response, as you see, is just the expression itself, since no simplification or operation was necessary or specified." "Do you know how to type 'control-characters'?" (AND (NOT (YESORNO)) (SCRIPT 'CTRLCHAR NIL)) "Control-G is the QUIT command for MACSYMA." "The other control characters you should know about for MACSYMA are:" "Control-L: this reprints the command line you are typing. On a display console it will also clear the screen. It is particularly useful if you have used rubout (delete) a lot and want to verify that you have everything right." "Control-^: this will put you into LISP, the language MACSYMA is written in. You will not usually want to use it, but should know about it so you can avoid typing it. If you do type it by mistake, control-G will get you back to a MACSYMA command line." "Control-A: this enters a MACSYMA break. This suspends the current computation, and allows you to 'poke around' in your MACSYMA, perhaps to open a file for output, or to see what the value of some variable is. To get out of the 'break' and resume the computation, type 'exit;'" "Control-]: this prints out the time used by the computation so far. You can type it at any point during a computation. Try it now to see how much CPU time this PRIMER session has used:" (SLEEP 8) "Now you are ready to move along to the Introductory Script of the Primer." (COND ((EQ 'WSMR (STATUS UNAME))(SCRIPT '$INTRO NIL)) (T (SEEN (STATUS UNAME) '$CONSOLEPRIMER))) (SCRIPT '$INTRO NIL)) (DEFSCRIPT $FRANZPRIMER "Welcome to the MACSYMA Primer. This section of the Primer is called the FRANZPRIMER because it is intended to be used by people who have not had previous experience interacting with a Franz Lisp version of MACSYMA, or maybe even with a computer console." (COND ((AND $PAGEPAUSE CURSORPOS)(SCRIPT 'CRTCONSOLE NIL))) "You will notice that your console looks much like a typewriter, except for having a few special keys. The two most important special keys are the 'altmode' and the 'control' key. The 'altmode' may be labeled 'alt', 'esc', '(sel)', or 'escape'. The 'control' key may be labeled 'CTRL' or 'CNTL'. The altmode is used to enter the MACSYMA editor. Do not attempt to use the editor while you are in the Primer since it may tend to confuse you. A future script will deal with editing. The control key is used in the same fashion as the shift key on the typwriter, i.e. you hold it down and type the character whose 'control' value you wish. For example, to type control-Z, you would hold down the control key and type a Z. Don't do that now, as control-Z is the control character that will return you to top level if you wish to interrupt your MACSYMA briefly." "The Primer will explain some of the aspects of MACSYMA to you and allow you to try out various examples. Your responses to the Primer must end with a semi-colon (;) followed by a carriage return (newline). That is the one thing which the Primer cannot correct you on, since it will not even see your response until you have typed the semi-colon and the carriage return. Thus if nothing seems to be happening, check that you have typed semi-colon carriage return." "In the Primer you should answer all questions the system asks. There are three kinds of questions:" "1. Questions you can answer with a yes or a no. You type the word YES or the word NO followed immediately by a semi-colon (;) and a carriage return to answer these. By convention in the primer we use upper case to make what you wish to type stand out from the rest of the text. However, in your answers you should use lower case. Try it here: Type YES; or NO;" (AND (YESORNO) (TERPRI)) "2. Questions which require you to select a script or an option. The system will print out a list, for example:" (MENU '($SIMPLIFICATION $SCRATCHPAD $ASSIGNMENT)) "This list is called the 'menu', the list of scripts available. You select a script to see by typing the number of your choice followed by a semi-colon (;) and a carriage return, to answer these. E.g." "3;" "Now you try it." (MENU '($SIMPLIFICATION $SCRATCHPAD $ASSIGNMENT)) (NUMCHK 3) "3. Requests to type in commands to MACSYMA. The system will make a request, such as 'Type in a polynomial in X,' and then give you a dummy MACSYMA command line number. You then type the command, followed by a semi-colon. This is to give you a chance to practice what you are learning. If you type the command correctly, the system will pass what you type to MACSYMA, and MACSYMA will evaluate it and return a response. If you make a mistake the system will attempt to tell you what you did wrong, and will offer you a chance to try again. Here, try typing X+2; followed by a carriage return." (INCHK '((MPLUS) $X 2)) "The response, as you see, is just the expression itself, since no simplification or operation was necessary or specified." "Do you know how to type 'control-characters'?" (AND (NOT (YESORNO)) (SCRIPT 'FRANZCTRLCHAR NIL)) "Control-C is the QUIT command for MACSYMA. It places you in a break loop from which you may return to MACSYMA, enter Lisp, enter a MACSYMA break for debugging, or return to the shell, killing MACSYMA." "The other control characters you should know about for MACSYMA are:" "Control-L: this reprints the command line you are typing. It is particularly useful if you have used (delete) a lot and want to verify that you have everything right." "Control-D: this will put you into LISP, the language MACSYMA is written in. You will not usually want to use it, but should know about it so you can avoid typing it. If you do type it by mistake, a second control-D will get you back to a MACSYMA command line." "Control-H (backspace): this deletes (erases) the last character you typed. It may be used repeatedly." (SLEEP 8) "Now you are ready to move along to the Introductory Script of the Primer." (COND ((EQ 'WSMR (STATUS UNAME))(SCRIPT '$INTRO NIL)) (T (SEEN (sys-user-id) '$franzprimer))) (SCRIPT '$INTRO NIL)) (DEFSCRIPT CRTCONSOLE "Since you have a display (CRT) console, there is one special thing you must know before we proceed: When the printout reaches the bottom of your screen, the system will print **MORE**, --More Display?--, or --Pause--, and the output will pause, leaving you as much time as you like to read what has been printed. When you are ready to continue, you hit the space bar once. The system will print --Continued-- and output will resume." ) (DEFSCRIPT CTRLCHAR (SSTATUS TTYINT 7 'NIL) "To type a control-character you use the key on your console labeled 'CTRL' or 'Control' in the same fashion as you would use the 'shift' key, that is you hold down the key labeled 'CTRL' and strike the key you want to make a control-character. The control-character which you will probably find the most useful in MACSYMA, is control-G. This is MACSYMA's 'QUIT' character, that is the character which will cause MACSYMA to stop what it is doing and accept more input from you. It is sort of the 'panic button', and will stop infinite loops. So you can find it and practice typing it, it is temporarily disabled as a 'QUIT' character." "Try typing it now:" (QUITCHK) (SSTATUS TTYINT 7 'MQUIT)) (DEFSCRIPT FRANZCTRLCHAR "To type a control-character you use the key on your console labeled 'CTRL' or 'Control' in the same fashion as you would use the 'shift' key, that is you hold down the key labeled 'CTRL' and strike the key you want to make a control-character. The control-character which you will probably find the most useful in MACSYMA, is control-C. This is MACSYMA's 'QUIT' character, that is the character which will cause MACSYMA to stop what it is doing and accept more input from you. It is sort of the 'panic button', and will stop infinite loops." ) (DEFUN NUMCHK (NUM) (TERPRI) (DO ANS (RETRIEVE NIL NIL) (RETRIEVE NIL NIL) NIL (COND ((EQ '$NO ANS) (TERPRI) (PRINC '|Well, all right, I'll show you.|) (TERPRI)(PRIN1 NUM)(PRINC '|;|)(RETURN (TERPRI))) ((NOT (EQ (TYPEP ANS) 'FIXNUM)) (TERPRI)(PRINC '|That isn't a number.|) (TERPRI)(PRINC '|Try again.|)(TERPRI)) ((AND (> ANS 0)(NOT (> ANS NUM)))(RETURN (TERPRI))) (T (TERPRI) (PRINC '|That number isn't in the list. Try again.|) (TERPRI))))) (DEFUN QUITCHK () (TERPRI) (DO ((X (TYI)(TYI))) (NIL) (COND ((OR (= X 103) (= X 71)) (TERPRI) (PRINC '|That was just a G, try again.|) (TERPRI) (PRINC '|Hold down the control key.|)(TERPRI)) ((= X 7) (TERPRI) (PRINC '|That's it, very good.|) (TERPRI) (PRINC '|Now we'll make it a quit character again, so|) (TERPRI) (PRINC '|only type it if you want to quit out of the PRIMER.|) (RETURN (TERPRI))) (T (TERPRI) (PRINC '|Nope, not quite. Try again, hold down the control key|) (TERPRI) (PRINC '|and hit the G.|)(TERPRI)))))