Re: Dumb sort question - Tanks Comments

2002-12-19 Thread jbv


Ken,

Sorry for being so late on this topic, but last week has been
sort of hectic...

Anyway, thanks a lot for your suggestion.
I found the time to test it today : it works great but, like the other
script submitted by Jacqueline, it becomes rather slow when the
amount of data gets large...

Best regards,
JB

 jb,

 I'm sorry that I came in late on this, but here's a way to do it with a
 custom transposing function... it may not be fast enough, but adapt it to
 your data and give it a try and let us know your results:

 on mouseUp
 -- A sample line number to extract
 put 3 into theLineToGet
 put 1 into theItemNumberToSortBy

 -- Some sample data
 put b,d,c,a  cr  2,4,3,1  cr  B,D,C,A  cr  20,40,30,10
 into tVar

 -- Transpose the data
 put transposeIt(tVar) into temp

 -- Sort it
 sort lines of temp by item theItemNumberToSortBy of each

 -- extract line (column) of data, put it into a field
 put line theLineToGet of transposeIt(temp) into fld 1
   end if
 end mouseUp

 function transposeIt what
   -- assumes comma-delimited items and cr-delimited lines
   put  into returnVal
   put 1 into tItemCounter
   repeat for each line tLine in what
 put 1 into tLineCounter
 if tItemCounter = 1 then
   -- use replace for quick action on first line of data
   replace , with cr in tLine
   put tLine into returnVal
 else
   repeat for each item i in tLine
 put , after line tLineCounter of returnVal
 put i after line tLineCounter of returnVal
 add 1 to tLineCounter
   end repeat
 end if
 add 1 to tItemCounter
   end repeat
   return returnVal
 end transposeIt

 Hope this helps,

 Ken Ray
 Sons of Thunder Software
 Email: [EMAIL PROTECTED]
 Web Site: http://www.sonsothunder.com/

 - Original Message -
 From: jbv [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Sunday, December 08, 2002 9:36 AM
 Subject: Re: Dumb sort question - Tanks  Comments

  Thank you all for your help  suggestions.
  Unfortunately, none of them helped solving
  my problem...
  Below you'll find a few more info on what
  I'm trying to do, comments on some suggestions
  and finally some feature requests for future versions
  of MC.
 
  Basically, I need to sort a variable featuring 5 lines
  with a max of 30,000 items each. The sort key could
  be any of the 5 lines, and after sorting I'd like to extract
  any line of the variable (get line 3 of myVariable) for
  further processing. The content of every item of every
  line can change / evolve continuously.
  When the variable is organized as 30,000 lines of 5 items
  each, sorting is a snap (less than 1 second), but then
  extracting 1 column is impossible...
 
 
  
  Jacqueline :
  Thanks for your script : it works great, but when the variable
  reaches 20,000 items per line, it becomes way too slow...
 
  
  Ray :
  Yes, the transpose function looks attracting, but unfortunately
  it only works on arrays. And once the array has been transposed,
  it seems impossible to extract 1 single line / row. I tried to put the
  array
  content into a variable, but it remains stractured as an array...
  BTW, when the size of a 2 dimensions array reaches a certain limit
  (5 rows  20,000 column), I get the error message : can't transpose
  this array (or something similar), while it works fine with 5 rows and
  10,000 colums... Is it a bug ?
 
  
  Mr X :
  Yes, 1 of the Rinaldi externals does that perfectly, but doesn't run
  on Windoze...
 
  
  Andu and Tariel :
  Yes, being able to access arrays content via individual rows  columns
  would be a GREAT feature...
  I'd even dare to say that future versions of MC should implement most
  of the properties  functions associated with spreadsheets in OMO, but
  applied to arrays, which means :
  - the ability to split arrays vertically  horizontally
  - the ability to extract individual rows / colums
  - the ability to sort the content of an array according to sort keys
  that
  could be individual rows / colums
  - a special find function that would work like in OMO spreadsheets :
  find rows of myTab where item 2  10
  would return a comma-separated list of numbers of rows for which
  this condition is true
 
  Actually, spreadsheets in OMO where 1 of the greatest tools I've ever
  used and I still miss them several years later...
  Of course, this would work on 1 or 2 dimension arrays; for 3 dimension
  arrays, things get more complex...
 
  Cheers,
  JB
 
 
 
  ___
  metacard mailing list
  [EMAIL PROTECTED]
  http://lists.runrev.com/mailman/listinfo/metacard
 

 ___
 metacard mailing list
 [EMAIL PROTECTED]
 http://lists.runrev.com/mailman/listinfo/metacard




___
metacard mailing list
[EMAIL

Re: Dumb sort question - Tanks Comments

2002-12-19 Thread Ken Ray
Thanks for checking...

Ken Ray
Sons of Thunder Software
Email: [EMAIL PROTECTED]
Web Site: http://www.sonsothunder.com/

- Original Message -
From: jbv [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, December 19, 2002 2:57 PM
Subject: Re: Dumb sort question - Tanks  Comments




 Ken,

 Sorry for being so late on this topic, but last week has been
 sort of hectic...

 Anyway, thanks a lot for your suggestion.
 I found the time to test it today : it works great but, like the other
 script submitted by Jacqueline, it becomes rather slow when the
 amount of data gets large...

 Best regards,
 JB

  jb,
 
  I'm sorry that I came in late on this, but here's a way to do it with a
  custom transposing function... it may not be fast enough, but adapt it
to
  your data and give it a try and let us know your results:
 
  on mouseUp
  -- A sample line number to extract
  put 3 into theLineToGet
  put 1 into theItemNumberToSortBy
 
  -- Some sample data
  put b,d,c,a  cr  2,4,3,1  cr  B,D,C,A  cr  20,40,30,10
  into tVar
 
  -- Transpose the data
  put transposeIt(tVar) into temp
 
  -- Sort it
  sort lines of temp by item theItemNumberToSortBy of each
 
  -- extract line (column) of data, put it into a field
  put line theLineToGet of transposeIt(temp) into fld 1
end if
  end mouseUp
 
  function transposeIt what
-- assumes comma-delimited items and cr-delimited lines
put  into returnVal
put 1 into tItemCounter
repeat for each line tLine in what
  put 1 into tLineCounter
  if tItemCounter = 1 then
-- use replace for quick action on first line of data
replace , with cr in tLine
put tLine into returnVal
  else
repeat for each item i in tLine
  put , after line tLineCounter of returnVal
  put i after line tLineCounter of returnVal
  add 1 to tLineCounter
end repeat
  end if
  add 1 to tItemCounter
end repeat
return returnVal
  end transposeIt
 
  Hope this helps,
 
  Ken Ray
  Sons of Thunder Software
  Email: [EMAIL PROTECTED]
  Web Site: http://www.sonsothunder.com/
 
  - Original Message -
  From: jbv [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Sunday, December 08, 2002 9:36 AM
  Subject: Re: Dumb sort question - Tanks  Comments
 
   Thank you all for your help  suggestions.
   Unfortunately, none of them helped solving
   my problem...
   Below you'll find a few more info on what
   I'm trying to do, comments on some suggestions
   and finally some feature requests for future versions
   of MC.
  
   Basically, I need to sort a variable featuring 5 lines
   with a max of 30,000 items each. The sort key could
   be any of the 5 lines, and after sorting I'd like to extract
   any line of the variable (get line 3 of myVariable) for
   further processing. The content of every item of every
   line can change / evolve continuously.
   When the variable is organized as 30,000 lines of 5 items
   each, sorting is a snap (less than 1 second), but then
   extracting 1 column is impossible...
  
  
   
   Jacqueline :
   Thanks for your script : it works great, but when the variable
   reaches 20,000 items per line, it becomes way too slow...
  
   
   Ray :
   Yes, the transpose function looks attracting, but unfortunately
   it only works on arrays. And once the array has been transposed,
   it seems impossible to extract 1 single line / row. I tried to put the
   array
   content into a variable, but it remains stractured as an array...
   BTW, when the size of a 2 dimensions array reaches a certain limit
   (5 rows  20,000 column), I get the error message : can't transpose
   this array (or something similar), while it works fine with 5 rows
and
   10,000 colums... Is it a bug ?
  
   
   Mr X :
   Yes, 1 of the Rinaldi externals does that perfectly, but doesn't run
   on Windoze...
  
   
   Andu and Tariel :
   Yes, being able to access arrays content via individual rows  columns
   would be a GREAT feature...
   I'd even dare to say that future versions of MC should implement most
   of the properties  functions associated with spreadsheets in OMO, but
   applied to arrays, which means :
   - the ability to split arrays vertically  horizontally
   - the ability to extract individual rows / colums
   - the ability to sort the content of an array according to sort keys
   that
   could be individual rows / colums
   - a special find function that would work like in OMO spreadsheets :
   find rows of myTab where item 2  10
   would return a comma-separated list of numbers of rows for which
   this condition is true
  
   Actually, spreadsheets in OMO where 1 of the greatest tools I've ever
   used and I still miss them several years later...
   Of course, this would work on 1 or 2 dimension arrays; for 3 dimension

Re: Dumb sort question - Tanks Comments

2002-12-08 Thread jbv
Thank you all for your help  suggestions.
Unfortunately, none of them helped solving
my problem...
Below you'll find a few more info on what
I'm trying to do, comments on some suggestions
and finally some feature requests for future versions
of MC.

Basically, I need to sort a variable featuring 5 lines
with a max of 30,000 items each. The sort key could
be any of the 5 lines, and after sorting I'd like to extract
any line of the variable (get line 3 of myVariable) for
further processing. The content of every item of every
line can change / evolve continuously.
When the variable is organized as 30,000 lines of 5 items
each, sorting is a snap (less than 1 second), but then
extracting 1 column is impossible...



Jacqueline :
Thanks for your script : it works great, but when the variable
reaches 20,000 items per line, it becomes way too slow...


Ray :
Yes, the transpose function looks attracting, but unfortunately
it only works on arrays. And once the array has been transposed,
it seems impossible to extract 1 single line / row. I tried to put the
array
content into a variable, but it remains stractured as an array...
BTW, when the size of a 2 dimensions array reaches a certain limit
(5 rows  20,000 column), I get the error message : can't transpose
this array (or something similar), while it works fine with 5 rows and
10,000 colums... Is it a bug ?


Mr X :
Yes, 1 of the Rinaldi externals does that perfectly, but doesn't run
on Windoze...


Andu and Tariel :
Yes, being able to access arrays content via individual rows  columns
would be a GREAT feature...
I'd even dare to say that future versions of MC should implement most
of the properties  functions associated with spreadsheets in OMO, but
applied to arrays, which means :
- the ability to split arrays vertically  horizontally
- the ability to extract individual rows / colums
- the ability to sort the content of an array according to sort keys
that
could be individual rows / colums
- a special find function that would work like in OMO spreadsheets :
find rows of myTab where item 2  10
would return a comma-separated list of numbers of rows for which
this condition is true

Actually, spreadsheets in OMO where 1 of the greatest tools I've ever
used and I still miss them several years later...
Of course, this would work on 1 or 2 dimension arrays; for 3 dimension
arrays, things get more complex...

Cheers,
JB



___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Dumb sort question - Tanks Comments

2002-12-08 Thread Tariel Gogoberidze
On 12/7/02 10:18 AM, Ernst M. Reicher wrote:

On 12/8/02 15:36 jbv [EMAIL PROTECTED] wrote:



-a special find function that would work like in OMO spreadsheets :
   find rows of myTab where item 2  10
   would return a comma-separated list of numbers of rows for which
 this condition is true
 Actually, spreadsheets in OMO where 1 of the greatest tools I've
 ever used and I still miss them several years later...


I second that. And I miss chart object form OMO even more.
About year ago I wrote here that HyperCard style debugger, OMO style 
spreadsheet and OMO Chart object is all I miss in MC.
Well, we just got great new debugger in upcoming v. 2.5, Table is 
partially implemented (at least it clips text  at the end of the 
column). This really gives me a hope that eventually MC will have it all :)

Tariel



___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Dumb sort question

2002-12-05 Thread Mark Luetzelschwab
This might be a dumb response, but if you are generating the data, can 
you generate it in a transposed form?

a,b,c,d
1,2,3,4

a,1
b,2
c,3
d,4

-ml



On Wednesday, December 4, 2002, at 04:59 PM, 
[EMAIL PROTECTED] wrote:

Dumb sort question But how can I sort a variable featuring 4 lines 
with several
hundreds of items in each, so that (for instance) items of
line 4 are sorted numeric ascending, and (that's important)
items of other lines being moved according to the new
position of each item of line 4 ?


Mark Luetzelschwab	(512) 232 9477 (v)
Database Coordinator	(512) 232 2322 (f)
Texas Ctr for Reading and Language Arts	 [EMAIL PROTECTED]
http://www.texasreading.org

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



RE: Dumb sort question

2002-12-05 Thread Mr X
for those on Macs, switch from Rinaldi does that real fast...

www.xcmdfactory.com

click on xcmds and then find switch...



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Mark Luetzelschwab
Sent: Thursday, December 05, 2002 1:08 AM
To: [EMAIL PROTECTED]
Subject: Re: Dumb sort question


This might be a dumb response, but if you are generating the data, can 
you generate it in a transposed form?

a,b,c,d
1,2,3,4

a,1
b,2
c,3
d,4

-ml



On Wednesday, December 4, 2002, at 04:59 PM, 
[EMAIL PROTECTED] wrote:

 Dumb sort question But how can I sort a variable featuring 4 lines 
 with several
hundreds of items in each, so that (for instance) items of
line 4 are sorted numeric ascending, and (that's important)
items of other lines being moved according to the new
position of each item of line 4 ?


Mark Luetzelschwab  (512) 232 9477 (v)
Database Coordinator(512) 232 2322 (f)
Texas Ctr for Reading and Language Arts  [EMAIL PROTECTED]
http://www.texasreading.org

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Dumb sort question

2002-12-05 Thread Richard Gaskin
Mr X wrote:

 This might be a dumb response, but if you are generating the data, can
 you generate it in a transposed form?
 
 a,b,c,d
 1,2,3,4
 
 a,1
 b,2
 c,3
 d,4

Would the transpose function do what you need?


-- 
 Richard Gaskin 
 Fourth World Media Corporation
 Developer of WebMerge 2.1: Publish any database on any site
 ___
 [EMAIL PROTECTED]   http://www.FourthWorld.com
 Tel: 323-225-3717   AIM: FourthWorldInc

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Dumb sort question

2002-12-04 Thread Ray Horsley
on 12/4/02 10:26 AM, jbv at [EMAIL PROTECTED] wrote:

 Hi everybody,
 
 Sorting a variable made of various lines with several items
 in each line with the sort command is easy :
 
 sort lines of Myvariable by item 2 of each
 
 
 But how can I sort a variable featuring 4 lines with several
 hundreds of items in each, so that (for instance) items of
 line 4 are sorted numeric ascending, and (that's important)
 items of other lines being moved according to the new
 position of each item of line 4 ?
 
 For instance :
 line 1 :b,d,c,a
 line 2 :2,4,3,1
 
 after sorting line 2, the content would become :
 line 1 :a,b,c,d
 line 2 :1,2,3,4
 
 I have the feeling this can't be done in MC, while I remember
 doing it in OMO using the spreadsheet control...
 
 Thanks for any suggestion.
 JB
 
 P.S. I need to do it FAST on large variables, therefore a repeat
 loop won't do.
 
 
 
 ___
 metacard mailing list
 [EMAIL PROTECTED]
 http://lists.runrev.com/mailman/listinfo/metacard
 

Suggestion:  Think along the lines of an array instead of straight
variables.


Ray Horsley
Developer, LinkIt! Software

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Dumb sort question

2002-12-04 Thread andu


--On Wednesday, December 04, 2002 18:26:32 + jbv 
[EMAIL PROTECTED] wrote:

Hi everybody,

Sorting a variable made of various lines with several items
in each line with the sort command is easy :

sort lines of Myvariable by item 2 of each


But how can I sort a variable featuring 4 lines with several
hundreds of items in each, so that (for instance) items of
line 4 are sorted numeric ascending, and (that's important)
items of other lines being moved according to the new
position of each item of line 4 ?

For instance :
line 1 :b,d,c,a
line 2 :2,4,3,1

after sorting line 2, the content would become :
line 1 :a,b,c,d
line 2 :1,2,3,4

I have the feeling this can't be done in MC, while I remember
doing it in OMO using the spreadsheet control...

Thanks for any suggestion.
JB

P.S. I need to do it FAST on large variables, therefore a repeat
loop won't do.


I don't think you can do it without at least one repeat since we don't have 
the concept of columns in MC.

This sounds good as a feature request - columns, columnDelimiter.

Regards, Andu Novac
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Dumb sort question

2002-12-04 Thread J. Landman Gay
On 12/4/02 12:26 PM, jbv wrote:


But how can I sort a variable featuring 4 lines with several
hundreds of items in each, so that (for instance) items of
line 4 are sorted numeric ascending, and (that's important)
items of other lines being moved according to the new
position of each item of line 4 ?

For instance :
line 1 :b,d,c,a
line 2 :2,4,3,1

after sorting line 2, the content would become :
line 1 :a,b,c,d
line 2 :1,2,3,4

I have the feeling this can't be done in MC, while I remember
doing it in OMO using the spreadsheet control...


You can do pretty much anything in MC. In this case, you can use a 
custom function to sort the data.

P.S. I need to do it FAST on large variables, therefore a repeat
loop won't do.


The following works for me with very short lists. It does have a repeat 
loop in it, so you'd have to see if it is fast enough for your needs. It 
could probably be optimized better.

local theOldOrder,theNewOrder

on dosort
  put fld 1 into theData
  put line 1 of theData into theOldOrder -- or whatever is the key line
  put theOldOrder into theNewOrder
  sort items of theNewOrder ascending numeric
  put theNewOrder  return into theNewData
  delete line 1 of theData
  repeat for each line l in theData
sort items of l by mySort(each,l,theOldOrder,theNewOrder)
put l  return after theNewData
  end repeat
  put theNewData into fld 2
end dosort

function mySort theItem,theLine
  set wholematches to true
  put itemoffset(theItem,theLine) into theItemNum
  put item theItemNum of theOldOrder into theOriginalItem
  put itemoffset(theOriginalItem,theNewOrder) into theNewPos
  return theNewPos
end mySort

--
Jacqueline Landman Gay | [EMAIL PROTECTED]
HyperActive Software   | http://www.hyperactivesw.com

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


Re: Dumb sort question

2002-12-04 Thread Ray Horsley
on 12/4/02 12:03 PM, jbv at [EMAIL PROTECTED] wrote:

 
 
 Ray,
 
 Suggestion:  Think along the lines of an array instead of straight
 variables.
 
 
 Yes, it crossed my mind...
 But the question is : how can I sort rows of an array using
 the sort command ?
 
 Thanks,
 JB
 
 
 ___
 metacard mailing list
 [EMAIL PROTECTED]
 http://lists.runrev.com/mailman/listinfo/metacard
 

JB,

I've read Jackie's suggestion and I think that's your best bet.


Ray Horsley
Developer, LinkIt! Software

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Dumb Sort Question

2001-12-13 Thread David C. Tremmel

Greg -

While not an elegant sort solution, you could do something like this 
(I'm assuming you want a list of grade frequencies as your end 
result):

gradeLevels = A+,A,A-,B+,...

repeat for each item X in gradeLevels
   put return  freqArray[X] after gradeFreqs
end repeat


Hope this helps...

Regards,
Dave Tremmel


Hi Everyone,

  I've created a neat little function that calculates stats and a
distribution for test grades very quickly.  To create a frequency
distribution of letter grades (how many A's, B's, C's, and so on), I use
an associative array where the keys are A+, A, A-, B+, B, B-, ..., F, and
I just plunk number grades into each element according to my conversion
criteria.

  My problem is that when I put the keys into a variable, say, Distn,
and sort it, it comes out as

  A
  A+
  A-

  rather than

  A+
  A
  A-

  which still represents the correct frquencies but is not convenient
to read.  Is there a handy trick to sorting Distn to get the order I
want?  I've tried to precede each key by a number ( 1  A+,  2 A, 3  A-,
...) and sort it, but I get gobbledeegoop.

  Regards,

   Greg




Gregory Lypny
Associate Professor
Concordia University

They had the best selection,
  The were poisoned by protection,
  There was nothing that they needed,
  They had nothing left to find.
- Neil Young


E-mail forum:   [EMAIL PROTECTED]
Visit Pareto at http://rubbersoul.concordia.ca
Visit Borsa at http://rubbersoul.concordia.ca/Borsa_Classroom
Crash site for notes and quizzes at
http://homepage.mac.com/gregorylypny/FileSharing1.html


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard


-- 
David Tremmel
Assistant Director, National Phytotron

Duke University
Phytotron Bldg. Phone:  (919) 660-7415
Box 90340   FAX:(919) 660-7425
Durham, NC  27708-0340  E-mail: [EMAIL PROTECTED]
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard