User Tools

Site Tools


its_lisp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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]].  Its direct ancestor is [[its_pdp6_lisp|PDP-6 LISP]]. The ITS Lisp is called Maclisp, or PDP-10 Maclisp if necessary to disambiguate it against [[Multics Maclisp]].  Its direct ancestor is [[its_pdp6_lisp|PDP-6 LISP]].
 +
 +**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               ;System herald
 +      
 +      :login smith                              ;The luser logs in
 +      
 +      :lisp                                     ;MACLISP is started
 +      
 +      LISP 2154                                 ;MACLISP version
 +      ALLOC? N                                  ;Take the world defaults
 +      
 +      (plus 3.14 2.71)                          ;Add two numbers
 +      5.85
 +      
 +      (car '(simple list))                      ;Return the CAR of a LIST
 +      SIMPLE
 +      
 +      (ledit)                                   ;Enters EMACS in LEDIT MODE
 +      
 +      (defun sum-squares (a b)                  ;Typed into the EMACS buffer
 +             (plus (times a a
 +                   (times b b))))               ;META-Z pushes DEFUN to the world
 +                                                ;CTRL-X Z returns to LISP
 +      
 +      ;READING FROM LEDIT SUN-SQUARES           ;Back in LISP
 +      ;EDIT COMPLETED
 +      
 +      (sum-squares 2.0 3.0)                     ;call SUM-SQUARES
 +      36.0                                      ;Returns the wrong number
 +      
 +      (ledit)                                   ;Re-enter EMACS in LEDIT MODE
 +      
 +      CTRL-S (times a a                         ;Typed into EMACS
 +                                                ;Search for STRING (times a a
 +      
 +      (defun sum-squares (a b)                  ;Correct SUM-SQUARES
 +             (plus (times a a)
 +                   (times b b)))                ;META-Z pushes new DEFUN to world
 +                                                ;CTRL-X Z returns to LISP
 +      
 +      ;READING FROM LEDIT SUM-SQUARES           ;Back in LISP
 +      ;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**
 +
 +     @maclisp                        ; start MACLISP at the TOPS-20 EXEC
 +     
 +     LISP 2122                       ; MACLISP Version 2122
 +     Alloc? n                        ; take the defaults
 +     
 +     
 +     
 +     (defun HELLO ()                 ; DEFINE FUNCTION "HELLO"
 +     (princ "Hello World!"))         ; print characters "Hello World!"
 +     HELLO                           ; MACLISP reports a definition for the function "HELLO"
 +     (hello)Hello World!             ; The function "HELLO" is called and "Hello World!" is printed
 +                                   ; MACLISP reports T for a successful function call
 +
 +     @maclisp
 +     
 +     LISP 2122
 +     Alloc? n
 +     
 +     
 +     *
 +     (loop for x in '(a b c d e)     ; Call the macro "LOOP" for VARIABLE "x" in a list of "a b c d e"
 +     do (print x))                   ; DO a PRINT of the value of "x"
 +     ;Loading LOOP 725               ; MACLISP loads LOOP version 725
 +     ;Loading DEFMAX 98              ; MACLISP loads DEFMAX version 98
 +                                   ; 1. X = A
 +                                   ; 2. X = B
 +                                   ; 3. X = C
 +                                   ; 4. X = D
 +                                   ; 5. X = E 
 +     NIL                             ; DO called PRINT X which returned NIL because there was nothing
 +                                     ; left to PRINT in the list of "a b c d e"
 +
 +**MATH examples**
 +
 +     @maclisp
 +     
 +     LISP 2122
 +     Alloc? n
 +     
 +     
 +         
 +     (+ 2 2)
 +     4
 +     (- 2 2)
 +     0
 +     (* 2 2)
 +     4
its_lisp.txt · Last modified: 2022/05/23 03:10 by ldbeth