I noticed today that BSD and MacOS X sort the results of a newLISP (directory) call differently when there are numbers involved...
In BSD:
("." ".." "10atom.lsp" "20cache.lsp" "default-plugin.lsp" "01debug.lsp")
In MacOS X:
("." ".." "01debug.lsp" "10atom.lsp" "20cache.lsp" "default-plugin.lsp")
I don't understand the BSD order...? Luckily, (sort) to the rescue...!
(directory) sort order
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact:
The order in which (directory) returns the entries is the same as doing an 'ls -f' in a shell window.
Only on Mac OS X this a (natural) alphabetical sort order. On other UNIX this is the order in which they appear in the OSs internal directory hash table, which depends on the hash function used and the sequence in which entries are created.
The only way to get a platform independent sort-order is to sort the list with 'sort'.
Only on Mac OS X this a (natural) alphabetical sort order. On other UNIX this is the order in which they appear in the OSs internal directory hash table, which depends on the hash function used and the sequence in which entries are created.
The only way to get a platform independent sort-order is to sort the list with 'sort'.
-
- Posts: 2038
- Joined: Tue Nov 29, 2005 8:28 pm
- Location: latiitude 50N longitude 3W
- Contact: