From: ··········@gmail.com
Subject: :wild in pathnames?
Date: 
Message-ID: <1111891269.143284.212090@o13g2000cwo.googlegroups.com>
hi, i try to make sense of what :wild do in pathnames.. i'm trying to
learn pathnames and currently is reading chapter 15 of the book
Practical Common Lisp.. He describe wild as: "...that has one or more
components containing the special value :wild and returns a list of
pathnames representing files in the file system that match the wild
pathname."

at least i don't quite get what exactly is wild pathname.. is it a wild
card kind thing that matches random arbitrary amount of pathnames? what
use would that be?

if anyone has any elaboration on pathnames to aid my study would be
much appreciated too :D 

thank you very much!

From: Pascal Bourguignon
Subject: Re: :wild in pathnames?
Date: 
Message-ID: <87br95vt8t.fsf@thalassa.informatimago.com>
··········@gmail.com writes:

> hi, i try to make sense of what :wild do in pathnames.. i'm trying to
> learn pathnames and currently is reading chapter 15 of the book
> Practical Common Lisp.. He describe wild as: "...that has one or more
> components containing the special value :wild and returns a list of
> pathnames representing files in the file system that match the wild
> pathname."
> 
> at least i don't quite get what exactly is wild pathname.. is it a wild
> card kind thing that matches random arbitrary amount of pathnames? what
> use would that be?
> 
> if anyone has any elaboration on pathnames to aid my study would be
> much appreciated too :D 
> 
> thank you very much!


[15]> (second (directory (make-pathname :name :wild :type "lisp")))
#P"/local/users/pjb/src/lisp/encours/unzip.lisp"

[16]> (directory (make-pathname :name "unzip" :type :wild))
(#P"/local/users/pjb/src/lisp/encours/unzip.lisp.~2~"
 #P"/local/users/pjb/src/lisp/encours/unzip.lisp.~1~"
 #P"/local/users/pjb/src/lisp/encours/unzip.lisp"
 #P"/local/users/pjb/src/lisp/encours/unzip.c")



More interesting yet is the :wild-inferior which allows to scan
subdirectories. For example, here is what I use to gather my ASDF
systems:


(defparameter *original-asdf-registry* ASDF:*CENTRAL-REGISTRY*)

(defun asdf-rescan-packages ()
  (SORT (DELETE-DUPLICATES 
         (MAPCAR
          (LAMBDA (P) (MAKE-PATHNAME :NAME NIL :TYPE NIL :VERSION NIL
                                     :DEFAULTS P))
          (DIRECTORY "PACKAGES:**;*.ASD"))  ; ** = :WILD-INFERIOR
         :test (function equal))
        (LAMBDA (A B) (if (= (length a) (length b))
                   (string< a b)
                   (< (length a) (length b))))
        :key (function namestring)))

(defun update-asdf-registry ()
  (setf ASDF:*CENTRAL-REGISTRY*
        (nconc (asdf-rescan-packages)
                *original-asdf-registry*)))

(update-asdf-registry)



Note that I did not ask for :version :wild but I still get them
because it's POSIX and there's no version in POSIX, only a convention
follewed here by emacs but not by my common lisp implementation.
Anyway each implementation chooses its own way to deal with it :-(

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
Wanna go outside.
Oh, no! Help! I got outside!
Let me back inside!
From: GP lisper
Subject: Re: :wild in pathnames?
Date: 
Message-ID: <1111987803.604edb4c8c8cafa1e42babe4fdbd3847@teranews>
On 27 Mar 2005 20:28:02 +0200, <····@mouse-potato.com> wrote:
>
>
> ··········@gmail.com writes:
>
>> hi, i try to make sense of what :wild do in pathnames.. i'm trying to
>> learn pathnames and currently is reading chapter 15 of the book
>> Practical Common Lisp.. He describe wild as: "...that has one or more
>> components containing the special value :wild and returns a list of
>> pathnames representing files in the file system that match the wild
>> pathname."
>> 
>> at least i don't quite get what exactly is wild pathname.. is it a wild
>> card kind thing that matches random arbitrary amount of pathnames? what
>> use would that be?
>> 
>> if anyone has any elaboration on pathnames to aid my study would be
>> much appreciated too :D 
>> 
>> thank you very much!
>
>
> [15]> (second (directory (make-pathname :name :wild :type "lisp")))
> #P"/local/users/pjb/src/lisp/encours/unzip.lisp"
>
> [16]> (directory (make-pathname :name "unzip" :type :wild))
> (#P"/local/users/pjb/src/lisp/encours/unzip.lisp.~2~"
>  #P"/local/users/pjb/src/lisp/encours/unzip.lisp.~1~"
>  #P"/local/users/pjb/src/lisp/encours/unzip.lisp"
>  #P"/local/users/pjb/src/lisp/encours/unzip.c")
>
>
>
> More interesting yet is the :wild-inferior which allows to scan
> subdirectories. For example, here is what I use to gather my ASDF
> systems:
>
>
> (defparameter *original-asdf-registry* ASDF:*CENTRAL-REGISTRY*)
>
> (defun asdf-rescan-packages ()
>   (SORT (DELETE-DUPLICATES 
>          (MAPCAR
>           (LAMBDA (P) (MAKE-PATHNAME :NAME NIL :TYPE NIL :VERSION NIL
>                                      :DEFAULTS P))
>           (DIRECTORY "PACKAGES:**;*.ASD"))  ; ** = :WILD-INFERIOR
>          :test (function equal))
>         (LAMBDA (A B) (if (= (length a) (length b))
>                    (string< a b)
>                    (< (length a) (length b))))
>         :key (function namestring)))
>
> (defun update-asdf-registry ()
>   (setf ASDF:*CENTRAL-REGISTRY*
>         (nconc (asdf-rescan-packages)
>                 *original-asdf-registry*)))
>
> (update-asdf-registry)
>
>
>
> Note that I did not ask for :version :wild but I still get them
> because it's POSIX and there's no version in POSIX, only a convention
> follewed here by emacs but not by my common lisp implementation.
> Anyway each implementation chooses its own way to deal with it :-(
>


-- 
Everyman has three hearts;
one to show the world, one to show friends, and one only he knows.