1
0
mirror of https://github.com/PDP-10/its.git synced 2026-02-27 01:09:49 +00:00

Introductory text and hello world for Maclisp.

This commit is contained in:
Lars Brinkhoff
2020-09-27 10:31:14 +02:00
parent 581362e82c
commit 210c513861
2 changed files with 37 additions and 0 deletions

View File

@@ -101,6 +101,7 @@ There are some short introductions for beginners:
- [TECO survival guide](doc/TECO.md)
- [DDT debugging newbie guide](doc/debugging.md)
- [Hello MIDAS](doc/hello-midas.md)
- [Hello Maclisp](doc/hello-lisp.md)
- [Introduction to Muddle](doc/muddle.md)
- [DUMP and itstar](doc/DUMP-itstar.md)
- [Games](doc/games.md)

36
doc/hello-lisp.md Normal file
View File

@@ -0,0 +1,36 @@
# Introduction to Maclisp
### A "hello world" example
Lisp programs can be developed in the interpreter, but serious
applications will usually be compiled and saved as standalone
executable programs.
Enter this small program and save it as `hello lisp`. Then compile it
with the command `:complr hello lisp`. Now the compiled code will be
in the file `hello fasl`. Make sure to kill the lingering COMPLR job,
or else the next step might fail.
```
(defun hello ()
(princ "Hello Maclisp!")
(terpri)
(quit))
```
To make the executable program, enter this code (comments are
optional) and save it as `hello dumper`. Then run the command `:lisp
hello dumper`. The result will be that Maclisp loads the `hello fasl`
file and writes out `ts hello`.
```
(comment) ;Avoid question about allocation.
(progn
(close (prog1 infile (inpush -1))) ;Make sure file channels are closed.
(fasload hello) ;Load the compiled program.
(gc) ;Garbage collect.
(purify 0 0 'bporg) ;Purify memory pages.
(sstatus flush t) ;Share pure pages with Maclisp.
(suspend ":kill " '(ts hello)) ;Save image as an executable program.
(hello)) ;Executable program will start from here.
```