On 26-Sep-02, Sean Johnson wrote:

> Content-Type: text/plain;
>     charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable

> =20
> Hi all,=20
> =20
> Been off the list for a while because I just couldn't keep up with
> the = volume of this great living list! Quickie question:=20 =20
> How do I get the code, listing: sort read %., to sort alphabetically
> by = directories first then by filenames? So, the result looks like
> this:
>>> sort read %.
> =3D=3D [%dir1/ %dir2/ %dir3/ %file1 %file2 %file3]
> =20
> I know I'm missing something easy here...maybe a sort option?
> =20
> Regards,=20
> =20
> Sean C. Johnson

Sort has a compare refinement that allows you to use a function to
make a comparison, the idea being to return true or false depending
on a comparison of two values.  (I think - I only used it for the
first time yesterday:)  For instance, this sorts on strings from the
second character onwards...

>> blk: ["xccc" "yaaa" "zbbb"]                     
== ["xccc" "yaaa" "zbbb"]
>> sort/compare blk func [a b][(second a) < second b]
== ["yaaa" "zbbb" "xccc"]

So, expand on that to sort your directory.  (My rushed attempt didn't
work, so I won't inflict it on you;)  Note, if you seperate your
function, use...

sort/compare blk :my-function

Note the colon.

-- 
Carl Read

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to