Groups
Groups
Sign in
Groups
Groups
Lisp中国用户组
Conversations
About
Send feedback
Help
Lisp:輸出
2 views
Skip to first unread message
panfei
unread,
Sep 13, 2012, 3:13:16 AM
9/13/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to lisp-...@googlegroups.com
(format t "~A plus ~A equals ~A.~%" 2 3 (+ 2 3))
2 plus 3 equals 5.
NIL
我們注意到這裡顯示了兩個東西。第一行是由format顯示的。第二行是調用format函式返回的值。通常像format這樣的函式不會在toplevel中直接被調用,而是被用在程序中,所以這樣的返回值是從來看不到的。
format的第一個參數,t,表明輸出被送往默認地點。通常這就是toplevel。第二個參數是作為輸出的字符串模板。在這個字符串中,每個~A代表一個需要被填充的位置,~%表示是一個新行。這些需要被填充的位置將會用後面的參數依照順序填充。
--
不学习,不知道
Reply all
Reply to author
Forward
0 new messages