home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1999 April
/
VPR9904A.BIN
/
Vpr_data
/
Special
/
Yoolw101
/
Yoolw101.lzh
/
PP.YO
< prev
next >
Wrap
Lisp/Scheme
|
1998-03-21
|
2KB
|
92 lines
;
; 整形プリント関数
;
(de 'pp '(lambda(x)(prog()
(setq tabcount 0)
(ppmain x)
)))
(de 'ppmain '(lambda(x)(prog(ppfirst)
(if (atom x)
(return (prog()
(princ x)
(return "")
))
)
(princ "( ")
(setq ppfirst nil)
(loop(first)
(if (null x)
(return (prog()
(princ ")")
(return "")
))
)
(setq first (car x))
(cond
((listp first) (ppmain first))
((null ppfirst)(prog()
(princ first)
(princ " ")
(switch first
(cond (prog()
(shift (cdr x))
(setq x nil)
))
(if (prog()
(shift (cdr x))
(setq x nil)
))
(switch (prog()
(princ (cadr x))
(shift (cddr x))
(setq x nil)
))
(prog (prog()
(princ (cadr x))
(shift (cddr x))
(setq x nil)
))
(loop (prog()
(princ (cadr x))
(shift (cddr x))
(setq x nil)
))
)
))
(t (prog()
(princ first)
(princ " ")
))
)
(setq ppfirst t)
(if (not (null x)) (setq x (cdr x)))
)
)))
(de 'shift '(lambda(x)(prog(cc)
(print "")
(setq tabcount (add1 tabcount))
(loop()
(if (null x)(return nil))
(printab)
(ppmain (car x))
(print "")
(setq x (cdr x))
)
(setq tabcount (sub1 tabcount))
(printab)
)))
(de 'printab '(lambda()(prog(cc)
(setq cc tabcount)
(loop()
(if (zerop cc)(return nil))
(princ " ")
(setq cc (sub1 cc))
)
)))
" リスト整形プログラム"
"(pp 整形したいリスト):入力されたリストデータを見やすくする。"