Hello every body ,
Actually I am very beginner in lisp and I have a home work to make some thing like dictionary .
I should make a menu that gives the user some choices like add new word or delete it or translate it .
I write this in txt file :
( loop
(print "==================================================================")
(print "Please Select One of This Choises ")
(print "==================================================================")
(print "==================================================================")
(print "1- translate ")
(print "2- add word ")
(print "3- delete word")
(print "0- exit")
(setf i (read))
(if (= i 1) (call translate) )
(if (= i 2) (call add))
(if (= i 3) (call delete))
(if (= i 4) (return "Good Bye"))
)
then when I load it like this ;
(load "t.lsp")
it write the print commands but at the end give this result :
"unexpected end of input stream "
please would you help me in this error
thank you
Write A menu for dictionary
Forum rules
Please respect your teacher's guidelines. Homework is a learning tool. If we just post answers, we aren't actually helping. When you post questions, be sure to show what you have tried or what you don't understand.
Please respect your teacher's guidelines. Homework is a learning tool. If we just post answers, we aren't actually helping. When you post questions, be sure to show what you have tried or what you don't understand.
Re: Write A menu for dictionary
I tried you code with clisp and it does not fail in the manner you describe.
I'm thinking you might use a different implementation that demands a line feed in the last line and you got none perhaps?
Other than that you may want to separate parts of your code in functions and even put the loop into a function so that you can load and test your parts individually. It makes debugging/testing easier.
br,
Syl
I'm thinking you might use a different implementation that demands a line feed in the last line and you got none perhaps?
Other than that you may want to separate parts of your code in functions and even put the loop into a function so that you can load and test your parts individually. It makes debugging/testing easier.
br,
Syl
I'm the author of two useless languages that uses BF as target machine.
Currently I'm planning a Scheme compiler :p
Currently I'm planning a Scheme compiler :p
Re: Write A menu for dictionary
Define this function
(defun menu ()
(print "==================================================================")
(print "Please Select One of This Choises ")
(print "==================================================================")
(print "==================================================================")
(print "1- translate ")
(print "2- add word ")
(print "3- delete word")
(print "0- exit")
(setf i (read))
(cond
((if (= i 1) (call translate) ))
((if (= i 2) (call add)) )
((if (= i 3) (call delete)) )
((if (= i 4) (return "Good Bye")) ) )
)
Call it later
(menu)
(defun menu ()
(print "==================================================================")
(print "Please Select One of This Choises ")
(print "==================================================================")
(print "==================================================================")
(print "1- translate ")
(print "2- add word ")
(print "3- delete word")
(print "0- exit")
(setf i (read))
(cond
((if (= i 1) (call translate) ))
((if (= i 2) (call add)) )
((if (= i 3) (call delete)) )
((if (= i 4) (return "Good Bye")) ) )
)
Call it later
(menu)
Re: Write A menu for dictionary
thank you very much .........
it seems good
it seems good