Page 1 of 1

The very beginning of a talking program - error

Posted: Mon Mar 23, 2015 4:11 am
by Grafoam
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 :

Code: Select all

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

Posted: Fri Mar 27, 2015 12:09 am
by Goheeca
The defun isn't a special construction, the parenthesis has to be in front of it.

Code: Select all

(defun read-input ()
  (format t "Enter text: ")
  (let ((s (read-line)))
    (format t "You entered: ~a~%" s)))