Perl に慣れてしまうと Common Lisp の長〜い名前に慣れないので、こういうのを用意しておくと便利かも。
 

 
;; http://modern-cl.blogspot.jp/2011/04/4-common-lisp.html
;; TRIVIAL-SHELL
(ql:quickload :trivial-shell)
 
;; (system "pwd")
(defun system (cmd-str)
 (trivial-shell:shell-command cmd-str))
 
;; http://weitz.de/cl-fad/
;; 日本語(Multi byte)のディレクトリ名が駄目みたい
(ql:quickload :cl-fad)
 
(defun -d (path) (cl-fad:directory-exists-p path))
 
(defun -e (path) (cl-fad:file-exists-p path))
 
(defun -f (file) (cl-fad:file-exists-p file))
 
(defun dirname (path) (cl-fad:pathname-directory-pathname path))
 
;; built-in
;; -----------------
 
(defun basename (path) (file-namestring path))
 
;; (glob "./*.lisp")
;; (glob "./*.lisp" #'basename)
(defun glob (arg &optional (fn #'namestring))
  (mapcar fn (directory arg)))
 
;; -----------------
 

 
 
 

§1488 · Posted By · 3月 13, 2014 · Development · Tags: , , , · [Print]