zoukankan      html  css  js  c++  java
  • 在顶层显示文件内容的函数

    CL-USER> (defun pseudo-cat (file)
           (with-open-file (str file :direction :input)
             (do ((line (read-line str nil 'eof)
                (read-line str nil 'eof)))
             ((eql line 'eof))
               (format t "~A~%" line))))
                   
    PSEUDO-CAT

    使用示例:

    CL-USER> (setf path (make-pathname :name "becky.txt"))
    #P"becky>.txt"
    CL-USER> (pseudo-cat path)
    aaaaaaaaaaaaa

    bbbbbbbbbbbbb

    ccccccccccccccccc

    ddddddddddddddd

    eeeeeeeeeeeeeeeeee

    ffffffffffffffffffffffffffff

    I love U ,becky!
    NIL
    CL-USER>

  • 相关阅读:
    [手游新项目历程]-36- error: stray ‘357’ in program
    广告学(一)
    VMware的Unity模式
    poj3709
    poj1849
    bzoj2007
    bzoj3209
    bzoj2466,poj1222
    bzoj1016
    bzoj2186
  • 原文地址:https://www.cnblogs.com/flowjacky/p/2841986.html
Copyright © 2011-2022 走看看