Common lisp Lisp:如何使用名为的循环,然后从
本lisp有效(SBCL 1.2.15):Common lisp Lisp:如何使用名为的循环,然后从,common-lisp,Common Lisp,本lisp有效(SBCL 1.2.15): 我不确定我做错了什么。似乎如果我已经命名了我的循环,我可以用(从rlp返回)突破有两种形式。第一个是简单的(循环形式…,这是您的第一个。第二种更为复杂,它使用一种复杂的语言,用循环关键字来描述循环。一旦您使用了名为的,您就进入了后者。试试(循环名为name do(cond…)有两种形式的。第一个是简单的(循环形式…,这是您的第一个。第二种更为复杂,它使用一种复杂的语言,用循环关键字来描述循环。一旦您使用了名为的,您就进入了后者。尝试(名为name do
我不确定我做错了什么。似乎如果我已经命名了我的循环,我可以用
(从rlp返回)
突破有两种形式。第一个是简单的(循环形式…,这是您的第一个。第二种更为复杂,它使用一种复杂的语言,用循环关键字来描述循环。一旦您使用了名为的,您就进入了后者。试试(循环名为name do(cond…)有两种形式的。第一个是简单的(循环形式…,这是您的第一个。第二种更为复杂,它使用一种复杂的语言,用循环关键字来描述循环。一旦您使用了名为的,您就进入了后者。尝试(名为name do(cond…)的循环)
(defun roman2 ()
(let ((x nil))
(loop
(cond
((null x) (format t "Enter number:") (setf x (read)))
((> x 39) (format t "too big~%") (setf x nil))
((> x 9) (prin1 'x) (setf x (- x 10)) )
((= x 9) (prin1 'ix) (setf x 0) )
((> x 4) (prin1 'v) (setf x (- x 5)) )
((= x 4) (prin1 'iv) (setf x 0) )
((> x 0) (prin1 'i) (setf x (1- x)) )
((zerop x) (setf x nil) (terpri))
((< x 0) (format t "Bye.") (return))))))
(defun roman2 ()
(let ((x nil))
(loop named rlp
(cond
((null x) (format t "Enter number:") (setf x (read)))
((> x 39) (format t "too big~%") (setf x nil))
((> x 9) (prin1 'x) (setf x (- x 10)) )
((= x 9) (prin1 'ix) (setf x 0) )
((> x 4) (prin1 'v) (setf x (- x 5)) )
((= x 4) (prin1 'iv) (setf x 0) )
((> x 0) (prin1 'i) (setf x (1- x)) )
((zerop x) (setf x nil) (terpri))
((< x 0) (format t "Bye.") (return-from rlp))))))
caught ERROR:
; during macroexpansion of (LOOP NAMED RLP ...). Use *BREAK-ON-SIGNALS* to
; intercept.