【入門】Common Lisp その9【質問よろず】
■ このスレッドは過去ログ倉庫に格納されています
0893デフォルトの名無しさん
2013/01/29(火) 02:56:31.69コード:
(handler-case (progn (princ "before") (/ 1 0) (princ "after"))
(error (c) (princ "catch")))
印字:beforeafter
返り値:"after"
>>892
マクロでなくて恐縮ですが、自分なら国をオブジェクトにして表記ごとのクラスを作り、総称関数を使います。
(defmethod timestamp ((country country-using-american-style))
(concatenate 'string (princ-to-string month) "/" (princ-to-string day) "/" (princ-to-string year)))
(defmethod timestamp ((country country-using-japanese-style))
(concatenate 'string (princ-to-string month) "/" (princ-to-string day) "/" (princ-to-string year)))
■ このスレッドは過去ログ倉庫に格納されています