Skip to content

Commit

Permalink
Introductory text and hello world for Maclisp.
Browse files Browse the repository at this point in the history
  • Loading branch information
larsbrinkhoff committed Sep 27, 2020
1 parent 581362e commit 5d61400
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions doc/hello-lisp.md
@@ -0,0 +1,35 @@
# 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`.

```
(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.
```

0 comments on commit 5d61400

Please sign in to comment.