1. Sorting by sequence member`

How can I sort the following sequence by 2nd, or 3rd member, using
nat_sort preferably.

{{"tony","nsw","Australia"},{"George","qld","Australia"},{"Mary","ca","USA"}}

ie: how do I sort by state or country

-- 
Regards
Tony Steward
www.locksdownunder.com

IF IT IS TO BE IT IS UP TO ME!

new topic     » topic index » view message » categorize

2. Re: Sorting by sequence member`

On 10 Oct 2004, at 15:28, Tony Steward wrote:

> 
> 
> How can I sort the following sequence by 2nd, or 3rd member, using
> nat_sort preferably.
> 
> {{"tony","nsw","Australia"},{"George","qld","Australia"},{"Mary","ca","USA"}}
> 
> ie: how do I sort by state or country

Use sorttok() or sortntok():

string = {"Fred,Astaire,45,Alberta,Canada",
          "Lucy,Ball,56,Barre,North Dakota",
          "Red,Skelton,34,London,England",
          "Pierre,du Pont,12,Paris,France"}
string = sorttok(string,3,',') 
string = {"Pierre,du Pont,12,Paris,France",
          "Red,Skelton,34,London,England",
          "Fred,Astaire,45,Alberta,Canada",
          "Lucy,Ball,56,Barre,North Dakota"}

It's also sorts *inside levels of sort*, so you can sort by country and inside
that sort
by state/provence and inside that sort by name,, nesting up to the limit of how
many
fields there are, in one sorttok() call. You can mix up and down sorting in the
levels.

Kat

new topic     » goto parent     » topic index » view message » categorize

3. Re: Sorting by sequence member`

Thanks Kat but where do I find sorttok.


On Sun, 10 Oct 2004 00:46:47 -0500, Kat <gertie at visionsix.com> wrote:
> 
> 
> On 10 Oct 2004, at 15:28, Tony Steward wrote:
> 
> >
> > How can I sort the following sequence by 2nd, or 3rd member, using
> > nat_sort preferably.
> >
> >
> > {{"tony","nsw","Australia"},{"George","qld","Australia"},{"Mary","ca","USA"}}
> >
> > ie: how do I sort by state or country
> 
> Use sorttok() or sortntok():
> 
> string = {"Fred,Astaire,45,Alberta,Canada",
>          "Lucy,Ball,56,Barre,North Dakota",
>          "Red,Skelton,34,London,England",
>          "Pierre,du Pont,12,Paris,France"}
> string = sorttok(string,3,',')
> string = {"Pierre,du Pont,12,Paris,France",
>          "Red,Skelton,34,London,England",
>          "Fred,Astaire,45,Alberta,Canada",
>          "Lucy,Ball,56,Barre,North Dakota"}
> 
> It's also sorts *inside levels of sort*, so you can sort by country and inside
> that sort
> by state/provence and inside that sort by name,, nesting up to the limit of
> how many
> fields there are, in one sorttok() call. You can mix up and down sorting in
> the levels.
> 
> Kat
> 
> 
> 
> 
> 


-- 
Regards
Tony Steward
www.locksdownunder.com

IF IT IS TO BE IT IS UP TO ME!

new topic     » goto parent     » topic index » view message » categorize

4. Re: Sorting by sequence member`

Tony Steward wrote:

> Thanks Kat but where do I find sorttok.

It's part of her strtok, which you can download from 
http://www.tiggrbox.info/program/Euphoria.html#StrTok

-- 
Craig

new topic     » goto parent     » topic index » view message » categorize

5. Re: Sorting by sequence member`

Kat your sorttok doesn't seem to like my data layout (i think) as it
returns nothing.

Will it work with data layed out as below?

{
                          {
                            {65'A',67'C',67'C',73'I',68'D',80'P',83'S',65'A',
78'N',73'I',71'G',72'H',84'T'},
                            {65'A',67'C',67'C',73'I',68'D',69'E',78'N',84'T',
32' ',38'&',32' ',69'E',77'M',69'E',82'R',71'G',69'E',78'N',67'C',89'Y'},
                            {80'P',83'S',65'A'},
                            {78'N',73'I',71'G',72'H',84'T',32' ',80'P',79'O',
82'R',84'T',69'E',82'R'},
                            {},
                            {},
                            {},
                            1
                          },
                          {
                            {65'A',76'L',73'I',83'S',79'O',68'D',65'A',86'V',
73'I',83'S',65'A',47'/',78'N',85'U',77'M'},
                            {65'A',76'L',73'I',83'S',79'O',78'N'},
                            {68'D',65'A',86'V',73'I',83'S'},
                            {65'A',47'/',78'N',85'U',77'M',32' ',67'C',65'A',
82'R',68'D',73'I',65'A',67'C',32' ',67'C',65'A',84'T',72'H',32' ',76'L',
65'A',66'B'},
                            {},
                            {},
                            {},
                            1
                          },
                          {
                            {65'A',76'L',83'S',79'O',80'P',69'E',83'S',84'T',
69'E',76'L',76'L',69'E',83'S',79'O',67'C',73'I',65'A'},
                            {65'A',76'L',83'S',79'O',80'P'},
                            {69'E',83'S',84'T',69'E',76'L',76'L',69'E'},
                            {83'S',79'O',67'C',73'I',65'A',76'L',32' ',87'W',
79'O',82'R',75'K'},
                            {},
                            {},
                            {},
                            0
                          }
}


On Sun, 10 Oct 2004 16:42:13 +1000, Craig Welch
<euphoria at welchaviation.org> wrote:
> 
> 
> Tony Steward wrote:
> 
> > Thanks Kat but where do I find sorttok.
> 
> It's part of her strtok, which you can download from
> http://www.tiggrbox.info/program/Euphoria.html#StrTok
> 
> --
> Craig
> 
> 
> 
> 
> 


-- 
Regards
Tony Steward
www.locksdownunder.com

IF IT IS TO BE IT IS UP TO ME!

new topic     » goto parent     » topic index » view message » categorize

6. Re: Sorting by sequence member`

Tony Steward wrote:
> 
> Kat your sorttok doesn't seem to like my data layout (i think) as it
> returns nothing.


Tony: I think custom_sort() will do what you want. Look it up in the 
docs (it's 5 a.m. here, I've been up since 2 a.m. and am too groggy to 
write a demo :)

Irv

new topic     » goto parent     » topic index » view message » categorize

7. Re: Sorting by sequence member`

I have looked at custom sort and the demo csort.exe but it just
doesn't sink in how to do it.

Can't run csort.ex as xp complains about running dos program

Tony


On Sun, 10 Oct 2004 02:10:07 -0700, irv mullins <guest at rapideuphoria.com>
wrote:
> 
> posted by: irv mullins <irvm at ellijay.com>
> 
> Tony Steward wrote:
> >
> > Kat your sorttok doesn't seem to like my data layout (i think) as it
> > returns nothing.
> 
> 
> Tony: I think custom_sort() will do what you want. Look it up in the
> docs (it's 5 a.m. here, I've been up since 2 a.m. and am too groggy to
> write a demo :)
> 
> Irv
> 
> 
> 
> 
> 


-- 
Regards
Tony Steward
www.locksdownunder.com

IF IT IS TO BE IT IS UP TO ME!

new topic     » goto parent     » topic index » view message » categorize

8. Re: Sorting by sequence member`

Tony Steward wrote:

> I have looked at custom sort and the demo csort.exe but it just
> doesn't sink in how to do it.
>
> Can't run csort.ex as xp complains about running dos program
>
> Tony
>
>
> On Sun, 10 Oct 2004 02:10:07 -0700, irv mullins <guest at rapideuphoria.com>
> wrote:
>>
>> posted by: irv mullins <irvm at ellijay.com>
>>
>> Tony Steward wrote:
>>>
>>> Kat your sorttok doesn't seem to like my data layout (i think) as it
>>> returns nothing.
>>
>>
>> Tony: I think custom_sort() will do what you want. Look it up in the
>> docs (it's 5 a.m. here, I've been up since 2 a.m. and am too groggy to
>> write a demo :)

The following code is slightly modified after the code that Andy Serpa
posted here on 25 Feb 2003. Very clean, straightforward, and flexible.
Thanks again, Andy!

object sort_i

function compare_index (object x1, object x2)
   -- Don't call this function directly, see below.
   integer comp, ix

   if integer(sort_i) then
      if sort_i > 0 then
         return  compare(x1[sort_i], x2[sort_i])
      else
         return -compare(x1[-sort_i], x2[-sort_i])
      end if
   end if

   for j = 1 to length(sort_i) do
      ix = sort_i[j]
      if ix > 0 then
         comp =  compare(x1[ix], x2[ix])
      else
         comp = -compare(x1[-ix], x2[-ix])
      end if
      if comp != 0 or j = length(sort_i) then
         return comp
      end if
   end for
end function

global function flex_sort (sequence s, object i)
   -- This is the function you actually call.
   -- s = sequence to be sorted (assumed to be at least 2-dimensional)
   -- i = integer index of element (column) to sort on,
   -- or sequence of indexes to sort on multiple fields
   -- (in order of preference).
-- If any given index is positive, then it will sort that element in
   ascending order.
   -- If negative, it will sort that element in descending order.
   sort_i = i
   return custom_sort(routine_id("compare_index"), s)
end function


Regards,
   Juergen

-- 
.... there are two ways of constructing a software design: One way is to
make it so simple that there are /obviously/ no deficiencies and the other
is to make it so complicated that there are no /obvious/ deficiencies.
[C.A.R. Hoare (1987), The Emperor's Old Clothes]

new topic     » goto parent     » topic index » view message » categorize

9. Re: Sorting by sequence member`

Tony Steward wrote:
> 
> How can I sort the following sequence by 2nd, or 3rd member, using
> nat_sort preferably.
> 
> {{"tony","nsw","Australia"},{"George","qld","Australia"},{"Mary","ca","USA"}}
> 
> ie: how do I sort by state or country

Here is some demo code
include sort.e

integer r_Sort_2
integer r_Sort_3

function Sort_2(object a, object b)

    if sequence(a)=0 or sequence(b)=0 then
        return 0
    end if
    
    if length(a)<2 or length(b)<2 then
        return 0
    end if
    
    return compare(a[2], b[2])
end function
r_Sort_2 = routine_id("Sort_2")


function Sort_3(object a, object b)

    if sequence(a)=0 or sequence(b)=0 then
        return 0
    end if
    
    if length(a)<3 or length(b)<3 then
        return 0
    end if
    
    return compare(a[3], b[3])
end function
r_Sort_3 = routine_id("Sort_3")
    

constant TestInput = {{"tony","nsw","Australia"},
                      {"Mary","ca","USA"},
                      {"George","qld","Australia"}
                     }


procedure DisplayTest(sequence m, sequence x)
    printf(1, "%s...\n",{ m })
    for i = 1 to length(x) do
        printf(1,"%-15s,%-3s, %-20s\n", x[i])
    end for
end procedure

DisplayTest( "Second element", custom_sort(r_Sort_2, TestInput) )
DisplayTest( "Third element", custom_sort(r_Sort_3, TestInput) )


Robert Craig: Can you supply a custom sort routine that takes a third,
user-supplied value which is passed to the routine_id untouched. That would
help a lot in reducing routines that are nearly the same etc.. Better
for generic programming.


-- 
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view message » categorize

10. Re: Sorting by sequence member`

Great that works for me THANKS


On Sun, 10 Oct 2004 12:39:17 +0200, Juergen Luethje <j.lue at gmx.de> wrote:
> 
> 
> Tony Steward wrote:
> 
> > I have looked at custom sort and the demo csort.exe but it just
> > doesn't sink in how to do it.
> >
> > Can't run csort.ex as xp complains about running dos program
> >
> > Tony
> >
> >
> > On Sun, 10 Oct 2004 02:10:07 -0700, irv mullins <guest at rapideuphoria.com>
> > wrote:
> >>
> >> posted by: irv mullins <irvm at ellijay.com>
> >>
> >> Tony Steward wrote:
> >>>
> >>> Kat your sorttok doesn't seem to like my data layout (i think) as it
> >>> returns nothing.
> >>
> >>
> >> Tony: I think custom_sort() will do what you want. Look it up in the
> >> docs (it's 5 a.m. here, I've been up since 2 a.m. and am too groggy to
> >> write a demo :)
> 
> The following code is slightly modified after the code that Andy Serpa
> posted here on 25 Feb 2003. Very clean, straightforward, and flexible.
> Thanks again, Andy!
> 
> }}}
<eucode>
> object sort_i
> 
> function compare_index (object x1, object x2)
>   -- Don't call this function directly, see below.
>   integer comp, ix
> 
>   if integer(sort_i) then
>      if sort_i > 0 then
>         return  compare(x1[sort_i], x2[sort_i])
>      else
>         return -compare(x1[-sort_i], x2[-sort_i])
>      end if
>   end if
> 
>   for j = 1 to length(sort_i) do
>      ix = sort_i[j]
>      if ix > 0 then
>         comp =  compare(x1[ix], x2[ix])
>      else
>         comp = -compare(x1[-ix], x2[-ix])
>      end if
>      if comp != 0 or j = length(sort_i) then
>         return comp
>      end if
>   end for
> end function
> 
> global function flex_sort (sequence s, object i)
>   -- This is the function you actually call.
>   -- s = sequence to be sorted (assumed to be at least 2-dimensional)
>   -- i = integer index of element (column) to sort on,
>   -- or sequence of indexes to sort on multiple fields
>   -- (in order of preference).
>   -- If any given index is positive, then it will sort that element in
>   ascending order.
>   -- If negative, it will sort that element in descending order.
>   sort_i = i
>   return custom_sort(routine_id("compare_index"), s)
> end function
> </eucode>
{{{

> 
> Regards,
>   Juergen
> 
> --
> .... there are two ways of constructing a software design: One way is to
> make it so simple that there are /obviously/ no deficiencies and the other
> is to make it so complicated that there are no /obvious/ deficiencies.
> [C.A.R. Hoare (1987), The Emperor's Old Clothes]
> 
> 
> 
> 
> 


-- 
Regards
Tony Steward
www.locksdownunder.com

IF IT IS TO BE IT IS UP TO ME!

new topic     » goto parent     » topic index » view message » categorize

11. Re: Sorting by sequence member`

On 10 Oct 2004, at 18:25, Tony Steward wrote:

> 
> 
> Kat your sorttok doesn't seem to like my data layout (i think) as it
> returns nothing.
> 
> Will it work with data layed out as below?
> 
> {
>                           {
>                             {65'A',67'C',67'C',73'I',68'D',80'P',83'S',65'A',
> 78'N',73'I',71'G',72'H',84'T'},
>                             {65'A',67'C',67'C',73'I',68'D',69'E',78'N',84'T',
> 32' ',38'&',32' ',69'E',77'M',69'E',82'R',71'G',69'E',78'N',67'C',89'Y'},
>                             {80'P',83'S',65'A'},
>                             {78'N',73'I',71'G',72'H',84'T',32' ',80'P',79'O',
> 82'R',84'T',69'E',82'R'},
>                             {},
>                             {},
>                             {},
>                             1
>                           },
>                           {
>                             {65'A',76'L',73'I',83'S',79'O',68'D',65'A',86'V',
> 73'I',83'S',65'A',47'/',78'N',85'U',77'M'},
>                             {65'A',76'L',73'I',83'S',79'O',78'N'},
>                             {68'D',65'A',86'V',73'I',83'S'},
>                             {65'A',47'/',78'N',85'U',77'M',32' ',67'C',65'A',
> 82'R',68'D',73'I',65'A',67'C',32' ',67'C',65'A',84'T',72'H',32' ',76'L',
> 65'A',66'B'},
>                             {},
>                             {},
>                             {},
>                             1
>                           },
>                           {
>                             {65'A',76'L',83'S',79'O',80'P',69'E',83'S',84'T',
> 69'E',76'L',76'L',69'E',83'S',79'O',67'C',73'I',65'A'},
>                             {65'A',76'L',83'S',79'O',80'P'},
>                             {69'E',83'S',84'T',69'E',76'L',76'L',69'E'},
>                             {83'S',79'O',67'C',73'I',65'A',76'L',32' ',87'W',
> 79'O',82'R',75'K'},
>                             {},
>                             {},
>                             {},
>                             0
>                           }
> }
> 
> 
> On Sun, 10 Oct 2004 16:42:13 +1000, Craig Welch
> <euphoria at welchaviation.org> wrote:
> > 
> > 
> > Tony Steward wrote:
> > 
> > > Thanks Kat but where do I find sorttok.
> > 
> > It's part of her strtok, which you can download from
> > http://www.tiggrbox.info/program/Euphoria.html#StrTok

Craig, yeas.
Tony, no. The demos work on nested flat sequences, which you apparently 
do not have. Those 0 and 1 in the example above are atoms. Half your fields 
are empty. I don't know what you sorted them by, where's the code you used 
to attempt it?

What you posted above is NOT what you posted in your first enquiry:

> {{"tony","nsw","Australia"},{"George","qld","Australia"},{"Mary","ca","USA"}}
> ie: how do I sort by state or country

To compare your complaint that sorttok didn't work, this is what you seem to 
have tried:

{{"tony","nsw","Australia","","","",1},{"George","qld","Australia","","","",1},{"Ma
ry","ca","USA","","","",0}}

And i would have said that i hadn't tried sorting atoms before, and no one had 
asked before. But i still don't know what you did.

Kat

new topic     » goto parent     » topic index » view message » categorize

12. Re: Sorting by sequence member`

Thanks Kat, I didn't want to sort the atoms.
The function Juergen sent is doing what I want.

Thanks everyone


On Sun, 10 Oct 2004 13:27:16 -0500, Kat <gertie at visionsix.com> wrote:
> 
> 
> On 10 Oct 2004, at 18:25, Tony Steward wrote:
> 
> >
> > Kat your sorttok doesn't seem to like my data layout (i think) as it
> > returns nothing.
> >
> > Will it work with data layed out as below?
> >
> > {
> >                           {
> >                            
> >                             {65'A',67'C',67'C',73'I',68'D',80'P',83'S',65'A',
> > 78'N',73'I',71'G',72'H',84'T'},
> >                            
> >                             {65'A',67'C',67'C',73'I',68'D',69'E',78'N',84'T',
> > 32' ',38'&',32' ',69'E',77'M',69'E',82'R',71'G',69'E',78'N',67'C',89'Y'},
> >                             {80'P',83'S',65'A'},
> >                             {78'N',73'I',71'G',72'H',84'T',32'
> >                             ',80'P',79'O',
> > 82'R',84'T',69'E',82'R'},
> >                             {},
> >                             {},
> >                             {},
> >                             1
> >                           },
> >                           {
> >                            
> >                             {65'A',76'L',73'I',83'S',79'O',68'D',65'A',86'V',
> > 73'I',83'S',65'A',47'/',78'N',85'U',77'M'},
> >                             {65'A',76'L',73'I',83'S',79'O',78'N'},
> >                             {68'D',65'A',86'V',73'I',83'S'},
> >                             {65'A',47'/',78'N',85'U',77'M',32'
> >                             ',67'C',65'A',
> > 82'R',68'D',73'I',65'A',67'C',32' ',67'C',65'A',84'T',72'H',32' ',76'L',
> > 65'A',66'B'},
> >                             {},
> >                             {},
> >                             {},
> >                             1
> >                           },
> >                           {
> >                            
> >                             {65'A',76'L',83'S',79'O',80'P',69'E',83'S',84'T',
> > 69'E',76'L',76'L',69'E',83'S',79'O',67'C',73'I',65'A'},
> >                             {65'A',76'L',83'S',79'O',80'P'},
> >                             {69'E',83'S',84'T',69'E',76'L',76'L',69'E'},
> >                             {83'S',79'O',67'C',73'I',65'A',76'L',32'
> >                             ',87'W',
> > 79'O',82'R',75'K'},
> >                             {},
> >                             {},
> >                             {},
> >                             0
> >                           }
> > }
> >
> >
> > On Sun, 10 Oct 2004 16:42:13 +1000, Craig Welch
> > <euphoria at welchaviation.org> wrote:
> > >
> > >
> > > Tony Steward wrote:
> > >
> > > > Thanks Kat but where do I find sorttok.
> > >
> > > It's part of her strtok, which you can download from
> > > http://www.tiggrbox.info/program/Euphoria.html#StrTok
> 
> Craig, yeas.
> Tony, no. The demos work on nested flat sequences, which you apparently
> do not have. Those 0 and 1 in the example above are atoms. Half your fields
> are empty. I don't know what you sorted them by, where's the code you used
> to attempt it?
> 
> What you posted above is NOT what you posted in your first enquiry:
> 
> >
> > {{"tony","nsw","Australia"},{"George","qld","Australia"},{"Mary","ca","USA"}}
> > ie: how do I sort by state or country
> 
> To compare your complaint that sorttok didn't work, this is what you seem to
> have tried:
> 
>
> {{"tony","nsw","Australia","","","",1},{"George","qld","Australia","","","",1},{"Ma
> ry","ca","USA","","","",0}}
> 
> And i would have said that i hadn't tried sorting atoms before, and no one had
> asked before. But i still don't know what you did.
> 
> Kat
> 
> 
> 
> 
> 


-- 
Regards
Tony Steward
www.locksdownunder.com

IF IT IS TO BE IT IS UP TO ME!

new topic     » goto parent     » topic index » view message » categorize

13. Re: Sorting by sequence member`

On 11 Oct 2004, at 8:01, Tony Steward wrote:

> 
> 
> Thanks Kat, I didn't want to sort the atoms.

But you gave the second example (including atoms) as what wasn't working, 
and i'd like to know what you did. I did say the first example you gave (which 
did not include atoms) would work, so what happened? If there is a totally 
unexplained random fault with strtok.e, i'll take it offline.

> The function Juergen sent is doing what I want.

That's good, there's many ways to do what you wanted. I figured you'd then 
need to write all the rest of the functionality already done in strtok.e for
your
database. I'd have been happy to check the code with your 1 and 0 atoms, 
and make the lib operate properly with them, if it didn't. All i have at this
point
is you saying the lib is faulty.

Kat

> Thanks everyone
> 
> 
> On Sun, 10 Oct 2004 13:27:16 -0500, Kat <gertie at visionsix.com> wrote:
> > 
> > 
> > On 10 Oct 2004, at 18:25, Tony Steward wrote:
> > 
> > >
> > > Kat your sorttok doesn't seem to like my data layout (i think) as it
> > > returns nothing.
> > >
> > > Will it work with data layed out as below?
> > >
> > > {
> > >                           {
> > >                            
> > >                             {65'A',67'C',67'C',73'I',68'D',80'P',83'S',65'A'
> > >                             ,
> > > 78'N',73'I',71'G',72'H',84'T'},
> > >                            
> > >                             {65'A',67'C',67'C',73'I',68'D',69'E',78'N',84'T'
> > >                             ,
> > > 32' ',38'&',32' ',69'E',77'M',69'E',82'R',71'G',69'E',78'N',67'C',89'Y'},
> > >                             {80'P',83'S',65'A'},
> > >                             {78'N',73'I',71'G',72'H',84'T',32'
> > >                             ',80'P',79'O',
> > > 82'R',84'T',69'E',82'R'},
> > >                             {},
> > >                             {},
> > >                             {},
> > >                             1
> > >                           },
> > >                           {
> > >                            
> > >                             {65'A',76'L',73'I',83'S',79'O',68'D',65'A',86'V'
> > >                             ,
> > > 73'I',83'S',65'A',47'/',78'N',85'U',77'M'},
> > >                             {65'A',76'L',73'I',83'S',79'O',78'N'},
> > >                             {68'D',65'A',86'V',73'I',83'S'},
> > >                             {65'A',47'/',78'N',85'U',77'M',32'
> > >                             ',67'C',65'A',
> > > 82'R',68'D',73'I',65'A',67'C',32' ',67'C',65'A',84'T',72'H',32' ',76'L',
> > > 65'A',66'B'},
> > >                             {},
> > >                             {},
> > >                             {},
> > >                             1
> > >                           },
> > >                           {
> > >                            
> > >                             {65'A',76'L',83'S',79'O',80'P',69'E',83'S',84'T'
> > >                             ,
> > > 69'E',76'L',76'L',69'E',83'S',79'O',67'C',73'I',65'A'},
> > >                             {65'A',76'L',83'S',79'O',80'P'},
> > >                             {69'E',83'S',84'T',69'E',76'L',76'L',69'E'},
> > >                             {83'S',79'O',67'C',73'I',65'A',76'L',32'
> > >                             ',87'W',
> > > 79'O',82'R',75'K'},
> > >                             {},
> > >                             {},
> > >                             {},
> > >                             0
> > >                           }
> > > }
> > >
> > >
> > > On Sun, 10 Oct 2004 16:42:13 +1000, Craig Welch
> > > <euphoria at welchaviation.org> wrote:
> > > >
> > > >
> > > > Tony Steward wrote:
> > > >
> > > > > Thanks Kat but where do I find sorttok.
> > > >
> > > > It's part of her strtok, which you can download from
> > > > http://www.tiggrbox.info/program/Euphoria.html#StrTok
> > 
> > Craig, yeas.
> > Tony, no. The demos work on nested flat sequences, which you apparently
> > do not have. Those 0 and 1 in the example above are atoms. Half your fields
> > are empty. I don't know what you sorted them by, where's the code you used
> > to
> > attempt it?
> > 
> > What you posted above is NOT what you posted in your first enquiry:
> > 
> > >
> > > {{"tony","nsw","Australia"},{"George","qld","Australia"},{"Mary","ca","USA"}
> > > } ie: how do I sort by state or country
> > 
> > To compare your complaint that sorttok didn't work, this is what you seem to
> > have tried:
> > 
> >
> > {{"tony","nsw","Australia","","","",1},{"George","qld","Australia","","","",1}
> > ,{"Ma ry","ca","USA","","","",0}}
> > 
> > And i would have said that i hadn't tried sorting atoms before, and no one
> > had
> > asked before. But i still don't know what you did.
> > 
> > Kat
> > 
> > 
> -- 
> Regards
> Tony Steward
> www.locksdownunder.com
> 
> IF IT IS TO BE IT IS UP TO ME!
> 
> 
> 
>

new topic     » goto parent     » topic index » view message » categorize

14. Re: Sorting by sequence member`

On 10 Oct 2004, at 18:15, Kat wrote:

> 
> 
> On 11 Oct 2004, at 8:01, Tony Steward wrote:
> 
> > 
> > Thanks Kat, I didn't want to sort the atoms.
> 
> But you gave the second example (including atoms) as what wasn't working, 
> and i'd like to know what you did. I did say the first example you gave (which
> did not include atoms) would work, so what happened? If there is a totally
> unexplained random fault with strtok.e, i'll take it offline.

From: http://tiggrbox.info/program/strtok-v2-1.html 
                                    Strtok
    Someone has said sorttok() doesn't work on their 3-line database. The 
    database was not optimum (flat) for strtok, but as i do not know what the 
    problem was, it is offline until i know how they broke it. I don't even 
    know how they called the function. But i am not looking into it myself at 
    this time. It works for me, i use it many times per minute, every hour of 
    every day. 


Kat

new topic     » goto parent     » topic index » view message » categorize

15. Re: Sorting by sequence member`

Gday Kat,
1stly I included your lib in my program.
Then after building the data to put into a EUGrid I called your
routine as follows:

PersonnelGridData = sorttok(PersonnelGridData,{3,4},',')

I'm not saying your lib doesn't work, I just couldn't get it to work &
to be honest I didn't try too hard.

Anyway I hope this helps. If I can be of any further assitance please
let me know.

Regards
Tony


On Sun, 10 Oct 2004 20:44:43 -0500, Kat <gertie at visionsix.com> wrote:
> 
> 
> On 10 Oct 2004, at 18:15, Kat wrote:
> 
> >
> > On 11 Oct 2004, at 8:01, Tony Steward wrote:
> >
> > >
> > > Thanks Kat, I didn't want to sort the atoms.
> >
> > But you gave the second example (including atoms) as what wasn't working,
> > and i'd like to know what you did. I did say the first example you gave
> > (which
> > did not include atoms) would work, so what happened? If there is a totally
> > unexplained random fault with strtok.e, i'll take it offline.
> 
> From: http://tiggrbox.info/program/strtok-v2-1.html
>                                    Strtok
>    Someone has said sorttok() doesn't work on their 3-line database. The
>    database was not optimum (flat) for strtok, but as i do not know what the
>    problem was, it is offline until i know how they broke it. I don't even
>    know how they called the function. But i am not looking into it myself at
>    this time. It works for me, i use it many times per minute, every hour of
>    every day.
> 
> 
> Kat
> 
> 
> 
> 
> 


-- 
Regards
Tony Steward
www.locksdownunder.com

IF IT IS TO BE IT IS UP TO ME!

new topic     » goto parent     » topic index » view message » categorize

16. Re: Sorting by sequence member`

On 11 Oct 2004, at 18:39, Tony Steward wrote:

> 
> 
> Gday Kat,
> 1stly I included your lib in my program.
> Then after building the data to put into a EUGrid I called your
> routine as follows:
> 
> PersonnelGridData = sorttok(PersonnelGridData,{3,4},',')

Why did you sort by 3,4, when the first example of the data had no 4th field, 
and the 2nd example had all 4th fields empty? The docs say: "If you supply 
a sort pattern that is longer than the number of tokens on a line in string, 
sorttok() will return "","

Kat

> I'm not saying your lib doesn't work, I just couldn't get it to work &
> to be honest I didn't try too hard.
> 
> Anyway I hope this helps. If I can be of any further assitance please
> let me know.
> 
> Regards
> Tony
> 
> 
> On Sun, 10 Oct 2004 20:44:43 -0500, Kat <gertie at visionsix.com> wrote:
> > 
> > 
> > On 10 Oct 2004, at 18:15, Kat wrote:
> > 
> > >
> > > On 11 Oct 2004, at 8:01, Tony Steward wrote:
> > >
> > > >
> > > > Thanks Kat, I didn't want to sort the atoms.
> > >
> > > But you gave the second example (including atoms) as what wasn't working,
> > > and i'd like to know what you did. I did say the first example you gave
> > > (which did not include atoms) would work, so what happened? If there is a
> > > totally unexplained random fault with strtok.e, i'll take it offline.
> > 
> > From: http://tiggrbox.info/program/strtok-v2-1.html
> >                                    Strtok
> >    Someone has said sorttok() doesn't work on their 3-line database. The
> >    database was not optimum (flat) for strtok, but as i do not know what the
> >    problem was, it is offline until i know how they broke it. I don't even
> >    know how they called the function. But i am not looking into it myself at
> >    this time. It works for me, i use it many times per minute, every hour of
> >    every day.
> > 
> > 
> > Kat
> > 
> > 
> -- 
> Regards
> Tony Steward
> www.locksdownunder.com
> 
> IF IT IS TO BE IT IS UP TO ME!
> 
> 
> 
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu