This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

The very beginning of a talking program - error

2 posts · 3067 views

Hello everybody,

I'm currently learning LISP since i've ever wanted to program a talking bot. I've looked around on the web and found many example and i've chosen LISP for both the challenge of learning a new language, the logical approach and recommendation about this language.

I've learned the basics, and now i'm starting to (and i know it is bad !) random try some program to start my project.

First, and so easy for everybody that i couldn't find any help on this, i want to catch input (as a string) from the user.

I've created a mini .lisp file with the following code :
defun( read-input ()
		(format t "Enter text : ")
		(let (s (read-line)))
		(format t "You entered ~s~%" s)
	)
When I load the program, i get a "DEFUN is unbound." error.

For now i'm stuck with this... If you could breing some enlightment to me, I would greatly appreciate,

Regards,

Charles

PS: My english is not my mother language so please feel free to correct me (so i can learn from my mistake) or just forgive my mistakes.

Re: The very beginning of a talking program - error

The defun isn't a special construction, the parenthesis has to be in front of it.
(defun read-input ()
  (format t "Enter text: ")
  (let ((s (read-line)))
    (format t "You entered: ~a~%" s)))
cl-2dsyntax is my attempt to create a Python-like reader. My mirror of CLHS (and the dark themed version). Temporary mirrors of aferomentioned: CLHS and a dark version.