2015-08-16 61 views
1

我在寫一個.dot文件的列表列表來生成一棵樹。看起來,lisp中漂亮的打印機在輸出中插入了新行,所以當我執行點文件時,新行會使讀取生成的圖形變得困難。在一條線上的Lisp漂亮打印對象

我看過format文檔,但我還沒有完全使用它。

下面是應打印樣本列表:

(((TOWER 'D 'C ^LEFT '0 ^RIGHT '2 ^BOTTOM '4 ^TOP '8) 
    (TOWER 'C 'B ^LEFT '0 ^RIGHT '2 ^BOTTOM '2 ^TOP '6) 
    (TOWER 'B 'A ^LEFT '0 ^RIGHT '2 ^BOTTOM '0 ^TOP '4) (ON 'D 'C) 
    (ON 'C 'B) (ON 'B 'A)) 
((TOWER 'D 'C ^LEFT '0 ^RIGHT '2 ^BOTTOM '4 ^TOP '8) 
    (TOWER 'C 'B ^LEFT '0 ^RIGHT '2 ^BOTTOM '2 ^TOP '6) 
    (TOWER 'B 'A ^LEFT '0 ^RIGHT '2 ^BOTTOM '0 ^TOP '4) (ON 'D 'C) 
    (ON 'C 'B) (ON 'B 'A)) 
((TOWER 'D 'C ^LEFT '0 ^RIGHT '2 ^BOTTOM '4 ^TOP '8) 
    (TOWER 'C 'B ^LEFT '0 ^RIGHT '2 ^BOTTOM '2 ^TOP '6) 
    (TOWER 'B 'A ^LEFT '0 ^RIGHT '2 ^BOTTOM '0 ^TOP '4) (ON 'D 'C) 
    (ON 'C 'B) (ON 'B 'A)) 
((TOWER 'D 'C ^LEFT '0 ^RIGHT '2 ^BOTTOM '4 ^TOP '8) 
    (TOWER 'C 'B ^LEFT '0 ^RIGHT '2 ^BOTTOM '2 ^TOP '6) 
    (TOWER 'B 'A ^LEFT '0 ^RIGHT '2 ^BOTTOM '0 ^TOP '4) (ON 'D 'C) 
    (ON 'C 'B) (ON 'B 'A)) 
((TOWER 'D 'C ^LEFT '0 ^RIGHT '2 ^BOTTOM '4 ^TOP '8) 
    (TOWER 'C 'B ^LEFT '0 ^RIGHT '2 ^BOTTOM '2 ^TOP '6) 
    (TOWER 'B 'A ^LEFT '0 ^RIGHT '2 ^BOTTOM '0 ^TOP '4) (ON 'D 'C) 
    (ON 'C 'B) (ON 'B 'A)) 
((TOWER 'D 'C ^LEFT '0 ^RIGHT '2 ^BOTTOM '4 ^TOP '8) 
    (TOWER 'C 'B ^LEFT '0 ^RIGHT '2 ^BOTTOM '2 ^TOP '6) 
    (TOWER 'B 'A ^LEFT '0 ^RIGHT '2 ^BOTTOM '0 ^TOP '4) (ON 'D 'C) 
    (ON 'C 'B) (ON 'B 'A))) 

這裏是清單如何被打印到文件:

(((TOWER 'D 'C 
^LEFT '0 
^RIGHT '2 
^BOTTOM '4 
^TOP '8) 
(TOWER 'C 'B 
^LEFT '0 
^RIGHT '2 
^BOTTOM '2 
^TOP '6) 
(TOWER 'B 'A 
^LEFT '0 
^RIGHT '2 
^BOTTOM '0 
^TOP '4) 
(ON 'D 'C) 
(ON 'C 'B) 
(ON 'B 'A)) 
((TOWER 'D 'C 
^LEFT '0 
^RIGHT '2 
^BOTTOM '4 
^TOP '8) 
(TOWER 'C 'B 
^LEFT '0 
^RIGHT '2 
^BOTTOM '2 
^TOP '6) 
(TOWER 'B 'A 
^LEFT '0 
^RIGHT '2 
^BOTTOM '0 
^TOP '4) 
(ON 'D 'C) 
(ON 'C 'B) 
(ON 'B 'A)) 
((TOWER 'D 'C 
^LEFT '0 
^RIGHT '2 
^BOTTOM '4 
^TOP '8) 
(TOWER 'C 'B 
^LEFT '0 
^RIGHT '2 
^BOTTOM '2 
^TOP '6) 
(TOWER 'B 'A 
^LEFT '0 
^RIGHT '2 
^BOTTOM '0 
... 
... 
... 

什麼format指令應該使用以獲得正確的格式輸出?

這裏是我使用

(format stream "~A [shape=record, label=\"{~A|~A|~A}\"];~%" a b c d) 
+0

您可能想要發佈可重現的測試代碼... –

+0

此版本是否有幫助? – myselfesteem

回答

3

如果設置*print-right-margin*到一個非常大的數字,漂亮的打印機不應該將任何新行的代碼。

默認爲nil表示設備的寬度(例如您的顯示器)。