Does there exist standard way to run external program in Common Lisp?

前端 未结 6 1669
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-11 15:07

In clisp, the following code works:

(defun hit-history () (shell \"tail ssqHitNum.txt\"))

However, in Clozure CL, the shell fu

6条回答
  •  渐次进展
    2021-01-11 16:05

    CL21 defines simple methods:

    (in-package :cl21-user)
    (use-package :cl21.process)
    

    Then either with run-process or with the #` reader macro:

    (run-process '("ls" "-l"))
    ;-> total 0
    ;   drwxrwxrwt    5 root         wheel   170 Nov  1 18:00 Shared
    ;   drwxr-xr-x+ 174 nitro_idiot  staff  5916 Mar  5 21:41 nitro_idiot
    ;=> #
    

    or

    #`ls -l /Users`
    ;=> "total 0
    ;   drwxrwxrwt    5 root         wheel   170 Nov  1 18:00 Shared
    ;   drwxr-xr-x+ 174 nitro_idiot  staff  5916 Mar  5 21:41 nitro_idiot
    ;   "
    ;   ""
    ;   0
    

    The source shows implementation for SBCL and CCL.

    • http://cl21.org/
    • https://github.com/cl21/cl21/wiki
    • https://lispcookbook.github.io/cl-cookbook/cl21.html

提交回复
热议问题