Hello World
-
3. Making Hello World
Create an Common LISP Hello World
First, I make a directory to keep things well ordered:mkdir ~/Documents/cLisp
Next Change to the Target cLisp directory with:
cd ~/Documents/cLisp
Now Edit the Hello World file:
nano helloworld.lisp
Here for simplicity I’ll make use of the nano editor…
So Append this Common LISP content:(defun hello-world () (format t "Hello, world!"))
Ctrl+x to Save & Exit from nano editor :)
-
4. Running Hello World
To Execute the Common LISP Hello World
First, give Execution Permissions to example:chmod +x helloworld.lisp
Then Launch the Lisp Cli Interpreter with:
clisp
Finally, Load and Run the example:1> load("helloworld.lisp") ;; Loading file helloworld.lisp ... ;; Loaded file helloworld.lisp T
Then to Run the Common LISP hello-world Function:
2> (hello-world) Hello world! NIL
In the end to Quit the Common LISP shell hits Ctrl+z.
Contents