This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
its_lisp [2020/04/08 11:33] lars |
its_lisp [2020/04/16 05:30] lars Fix markup. |
||
---|---|---|---|
Line 2: | Line 2: | ||
The ITS Lisp is called Maclisp, or PDP-10 Maclisp if necessary to disambiguate it against [[Multics Maclisp]]. | The ITS Lisp is called Maclisp, or PDP-10 Maclisp if necessary to disambiguate it against [[Multics Maclisp]]. | ||
+ | |||
+ | **A sample MACLISP session on ITS using LEDIT MODE in EMACS** | ||
+ | //LEDIT will work on both [[its_topics|ITS]] and [[TOPS-20]] ;tnx1.0e6 to GLS// | ||
+ | | ||
+ | KA ITS 1648 DDT 1547 TTY 52 ; | ||
+ | | ||
+ | :login smith ;The luser logs in | ||
+ | | ||
+ | :lisp ; | ||
+ | | ||
+ | LISP 2154 ; | ||
+ | ALLOC? N ;Take the world defaults | ||
+ | | ||
+ | (plus 3.14 2.71) ;Add two numbers | ||
+ | 5.85 | ||
+ | | ||
+ | (car ' | ||
+ | SIMPLE | ||
+ | | ||
+ | (ledit) | ||
+ | | ||
+ | (defun sum-squares (a b) ;Typed into the EMACS buffer | ||
+ | (plus (times a a | ||
+ | | ||
+ | ;CTRL-X Z returns to LISP | ||
+ | | ||
+ | ;READING FROM LEDIT SUN-SQUARES | ||
+ | ;EDIT COMPLETED | ||
+ | | ||
+ | (sum-squares 2.0 3.0) ;call SUM-SQUARES | ||
+ | 36.0 ;Returns the wrong number | ||
+ | | ||
+ | (ledit) | ||
+ | | ||
+ | CTRL-S (times a a ; | ||
+ | ;Search for STRING (times a a | ||
+ | | ||
+ | (defun sum-squares (a b) ;Correct SUM-SQUARES | ||
+ | (plus (times a a) | ||
+ | | ||
+ | ;CTRL-X Z returns to LISP | ||
+ | | ||
+ | ;READING FROM LEDIT SUM-SQUARES | ||
+ | ;EDIT COMPLETED | ||
+ | | ||
+ | (sum-squares 2.0 3.0) ;Call SUM-SQUARES again | ||
+ | 13.0 ;Correct result | ||
+ | |||
+ | //The LISP ... Editor ... LISP ... loop will no doubt be repeated many times.// | ||
+ | |||
+ | **HELLO WORLD and LOOP examples** | ||
+ | |||
+ | | ||
+ | |||
+ | LISP 2122 ; MACLISP Version 2122 | ||
+ | | ||
+ | |||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | LISP 2122 | ||
+ | | ||
+ | |||
+ | |||
+ | * | ||
+ | (loop for x in '(a b c d e) ; Call the macro " | ||
+ | do (print x)) ; DO a PRINT of the value of " | ||
+ | ; | ||
+ | ; | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | ; left to PRINT in the list of "a b c d e" | ||
+ | |||
+ | **MATH examples** | ||
+ | |||
+ | | ||
+ | |||
+ | LISP 2122 | ||
+ | | ||
+ | |||
+ | |||
+ | | ||
+ | (+ 2 2) | ||
+ | 4 | ||
+ | (- 2 2) | ||
+ | 0 | ||
+ | (* 2 2) | ||
+ | 4 |