0

I'm unable to print the return value of return-str.

; return-str.lisp (defun ask-for-input(str) (princ str) (let ((cmd (read-line))) cmd)) (defun return-str() (let ((data-str (ask-for-input "enter a string"))) (data-str))) (princ return-str) 

Executing the code above with clisp, I got:

$ clisp return-str.lisp *** - EVAL: variable RETURN-STR has no value 

Please help me on how to properly return a string from return-str.

Thank you.

1 Answer 1

3

Your parentheses are incorrect in a couple of places.

  • (data-str) should be replaced with data-str because data-str is not a function.
  • (princ return-str) should be replaced with (princ (return-str)) because return-str is a function.
Sign up to request clarification or add additional context in comments.

1 Comment

That was fast and fixed my problem! Thank you.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.