(defun xyp-GetFolders (path SubFolders-TNil / main sub folder)
(defun main (path / folders)
(if (member "." (setq folders (vl-directory-files path nil -1)))
(cddr folders)
folders
)
)
(defun sub (path)
(mapcar (function (lambda (folder / temp)
(cons (setq temp (strcat path "/" folder))
(apply 'append (sub temp))
)
))
(main path)
)
)
(if (setq lst
(if SubFolders-TNil
(apply (function append) (sub path))
(if (setq folders (main path))
(mapcar (function (lambda (x) (strcat path "/" x))) folders)
)
)
)
(vl-sort (mapcar (function strcase) lst) (function <))
)
)
I don't seem to be able to get at a tail-call-recursive method for this though.AFAIK, AutoLISP doesn't manage tail-recursion.
Oopss !! I confused Directory and dictionary :ugly:
Look at the vl-directory-files function with -1 flag.
;dir_list2.lsp
;Created for AFTS by P.R. Donnelly
;Date: Aug of 2012
;Description: Lists subdirectories in a given directory
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;start prog
(DEFUN C:dir_list2 ()
;;;;;;;;;;;;;;;;;;;;;;;;;Select directory to be processed
(setq dfil (getfiled "Select a **FILE** in the directory you want to list, then click on OPEN" "y:/" "*" 0))
(setq wutdir (vl-filename-directory dfil))
(setq wutfiles (vl-directory-files wutdir nil -1))
(setq dwglistfile (strcat wutdir "\\dir_list2.txt"))
(SETQ dwgfiler (OPEN dwglistfile "w"))
(WRITE-LINE wutdir dwgfiler)
(foreach n wutfiles
(WRITE-LINE n dwgfiler)
(princ)
)
(alert "\n***File DIR_LIST2.TXT has been created in the directory you chose.***")
(CLOSE dwgfiler)
(startapp "notepad" dwglistfile)
(princ)
);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DEFUN
Its people like you PKENEWELL that make me wonder why I even bother sharing my code at all.Hi Lee Mac
For all the effort and time that I invest in updating my site, I only ask that the headers and author accreditation are retained where my code is used, and you have the sheer audacity to strip my name entirely from my code and bluntly claim it as your own - hell, you couldn't even be bothered to write your own description but had to steal that from my site too.
Well, what can I say - don't expect any help from me if ever you post a question to this forum, and I doubt the community here will now be queuing to lend you a hand.
Its people like you PKENEWELL that make me wonder why I even bother sharing my code at all.
Its people like you PKENEWELL that make me wonder why I even bother sharing my code at all.
For all the effort and time that I invest in updating my site, I only ask that the headers and author accreditation are retained where my code is used, and you have the sheer audacity to strip my name entirely from my code and bluntly claim it as your own - hell, you couldn't even be bothered to write your own description but had to steal that from my site too.
Well, what can I say - don't expect any help from me if ever you post a question to this forum, and I doubt the community here will now be queuing to lend you a hand.
Lee my friend, you know I'm supportive of your efforts to share code and educate the community, but is there a chance this is not a case of plagerism? The underlying algorythm has been done many times by many different authors, each translating MSDN code to LISP. There's only so many variants for such a small code snip that can be penned, none of them would appear all that unique. The header information, i.e. flag states etc. too originates from MSDN if I'm not mistaken.
Just saying.
If there's blatant plagerism I support your want to have a wrong fixed, but I'm highly doubtful -- Mr. Kenewell has been around a long time, and I have no reason to think he would need to lift another's code, passing it off as his.
Sincerely, Michael.
Lee,
I think we all 'stole' some LISP code since the pionneers (as Reini Urban, Vladimir Nesterovsky, ...).
What should I say when I see in your Mathematical Functions (http://www.lee-mac.com/mathematicalfunctions.html) exactly the same defun names for dot product (vxv) and cross product (v^v) as those I wrote (http://cadxp.com/index.php?/topic/8890-vecteur-normale-angle-3d/) in 2005 ?
Why does an English guy uses the quite now obsolete French math symbols for these functions ?
I'm not sure what you mean by the 'obsolete French math symbols'
En France, le produit vectoriel de u et de v est noté u∧v, où le symbole ∧ se lit wedge ou vectoriel. Cette notation a été initiée par Cesare Burali-Forti et Roberto Marcolongo en 1908. [...]Google translation:
Dans la littérature anglophone (et au Canada francophone, ainsi qu'en Suisse), le produit vectoriel est noté u×v. Cette notation est due à Josiah Willard Gibbs.
In France, the vector product of u and v is denoted u ∧ v, where the symbol ∧ reads wedge or vector. This rating was initiated by Cesare Burali-Forti and Roberto Marcolongo in 1908 . [...]
In the English literature (and in French Canada, and Switzerland), the vector product u × v is noted. This notation is due to Josiah Willard Gibbs.
QuoteI'm not sure what you mean by the 'obsolete French math symbols'
Extract from Wikipedia (http://fr.wikipedia.org/wiki/Produit_vectoriel) (fr)QuoteEn France, le produit vectoriel de u et de v est noté u∧v, où le symbole ∧ se lit wedge ou vectoriel. Cette notation a été initiée par Cesare Burali-Forti et Roberto Marcolongo en 1908. [...]Google translation:
Dans la littérature anglophone (et au Canada francophone, ainsi qu'en Suisse), le produit vectoriel est noté u×v. Cette notation est due à Josiah Willard Gibbs.QuoteIn France, the vector product of u and v is denoted u ∧ v, where the symbol ∧ reads wedge or vector. This rating was initiated by Cesare Burali-Forti and Roberto Marcolongo in 1908 . [...]
In the English literature (and in French Canada, and Switzerland), the vector product u × v is noted. This notation is due to Josiah Willard Gibbs.
Long time ago, at school I learned the first notation that's the reason why I called my cross product v^v. In France this notation tend to disapear these days and more and more use the u X v "English" notation now.
I think that if I had an English culture (or if i was younger) I'd choose vxv for the cross product and something like v*v for the dot product.
Anyway, there's nothing against you, as I said I consider were are all "hackers" and I don't remember I ever "signed" these little routines I published many times here and elsewhere, so I do not reclaim any credit for that.
I must confess I did not review the code line for line as I'm swamped.Eye see what you did there. :wink:
1+I must confess I did not review the code line for line as I'm swamped.Eye see what you did there. :wink:
You are absolutely correct and I give you my sincere apologies. In my defence I have not intented to take credit for your code, nor am I using it for ill gains - not even in my own workplace. It is my fault however that I did not retain the credit for your code in my utilities. I simply reformated the function names and headers to keep them organized in my personal utilities. It was a more major mistake on my part as well to share it on this site without giving you your due credit. From now on: If the code is not originally mine - I will in the least part keep the credit where it is due in the header of the code. In fact - I will not even post code from my personal utilities if I did not originally author it. I will edit my earlier post and add credit for your excellent work. So - I throw myself at the mercy of the court. My ignorance will not be repeated!
< .. >
So - I throw myself at the mercy of the court.
...
We all stand on the shoulders of giants.
...
...
We all stand on the shoulders of giants.
...
ourselves become giants... 8-)
All too true. I don't think I could've written anything meaningful without seeing some examples from "Giants". I've even got some tips from yourself in the past (and many others including Lee). I try to give credit, but the issue is where does it stop. Where does the code become yours and where is it still just a modification you did to someone else's code?...
We all stand on the shoulders of giants.
...
ourselves become giants... 8)Well ... we hope so! :kewl: IMO you have!