だから私は最近Lispを独学し、いくつかのプログラムをいじっています。ユーザーが入力したクラスのリストを比較し、連携できるクラスを見つける小さなプログラムを作成しようとしています。以下は、ユーザーからデータを収集し、クラスがいつであるかのリストを作成する最初の部分です。
(defun class-entries ()
(setf Monday 0) ;initializes the days of the week
(setf Tuesday 0)
(setf Wednesday 0)
(setf Thursday 0)
(setf Friday 0)
(setf times 100)
(dotimes (repeating times "You have reached the limit of entries") ;repeats the following for the number of classes that you are comparing
(dolist (dayofweek '(Monday Tuesday Wednesday Thursday Friday)) ;repeats the following for each day of the week
(print (concatenate 'string "Does this class occur on " dayofweek " ?"))
(setf isday (read))
(if (= isday 1) ;prompts the questions if there is a class that day
(progn
(print (concatenate 'string "What time does the class begin on " dayofweek " ?"))
(setf starttime (read))
(print (concatenate 'string "What time does the class end on " dayofweek " ?"))
(setf endtime (read)))
(setf isday 0))
(if (= isday 0) ;Adds the list of (startime endtime) to the current day of week or nil if there isn't a class that day
(setf 'dayofweek '"nil")
(setf 'dayofweek '(starttime endtime))))
(print "What is the title of the class?")
(setf (read) '((mon (Monday)) (tues (Tuesday)) (wed (Wednesday)) (thurs (Thursday)) (fri (friday)))) ;sets a new variable to the values of the classes's hours
(print "Is there another class?") ;repeats the function for another class or ends it
(setf isclass (read))
(if (= isclass 0)
(setf times 0)
()))
(setf times 100)
)
関数を評価すると、0 のみが返され、他には何も表示されません。Listener を使用していないためかどうかはわかりません。ありがとう。