私の目標は、テーブルを各列の間に均等にスペースを空けて印刷することです。
(defn PrintTable [tableName]
"prints table in clear format"
(let [tableRef (get (deref dataBase) tableName) ; get refrence for table
keyList (keys @tableRef)] ; get key list of table
(doseq [tableKeys (range (count keyList))] ; print the keys of the table
(let [key (nth (keys @tableRef) tableKeys)]
(print key "\t|"))
)
(println)
(doseq [rows (range (count @(tableRef (nth (keys @tableRef) 0))))] ; print for each rows all the values
(doseq [cols (range (count keyList))]
(let [key (nth (keys @tableRef) cols)]
(print (@(tableRef key) rows) "\t|")
)
)
(println)
)
)
(println)
)
私はタブを使用してみましたが、これは私が得る結果です:
P_Id |LastName |FirstName |Address |City |
1 |Darmon |Gilad |ishayahu |Haifa |
2 |SM |Shiran |erez |RamatIshay |
D_Id |Name |OwnerLastName |OwnerFirstName |
a |Bono |Darmon |Gilad |
b |Bony |SM |Shiran |
より適切で整列した印刷の提案はありますか?