Re: request for comments- strtok

new topic     » goto parent     » topic index » view thread      » older message » newer message

Kat,
the problem with this is that you are using one parameter to specify two
things : element and direction. You would be better off using two
parameters. Actually you might consider three parameters: Element,
Direction, and Relativity. And as these are always used, you could put them
in a sequence so that you can specify multiple sort keys.

    -- Sort 's' in descending order using the 2 from the end as the key.
    sorttok(s, {{Descending, 2, FromEnd}})

    -- Sort 's' first element ascending and last element descending.
    sorttok(s, {{Ascending, 1, FromStart},{Ascending, 1, FromEnd}})



----- Original Message -----
From: "Kat" <gertie at PELL.NET>
To: "EUforum" <EUforum at topica.com>
Sent: Friday, July 12, 2002 2:10 PM
Subject: request for comments- strtok


>
> For sorttok(), a negative sort parm as an atom currently reverses the
sort,
> like this:
>
> s = {"a b a a","a c a a"}
> s = sorttok(s,-2,32)
> s now= {"a c a a","a b a a"}
>
> but i can't use this syntax to spec sorting on the 2nd token from the
right.
> What would you do?
>
> Kat
>
>
>
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu