Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: sort/skip

From: joel:neely:fedex at: 12-Nov-2001 14:51

Hi, Jim, Jim Clatfelter wrote:
> I need to sort a file of homeowner data to print a list for the front > gate codes. There are 7 fields in each record, so I tried: > > button blue / 1.2 "Gate List" [ > gate-list: copy my-data > sort/skip gate-list 7 > print gate-list > ] > > ** Script Error: Invalid argument: 7 > ** Where: func [face value][ > gate-list: copy my-data > sort/skip gate-list 7 > print gate-list > ] > ** Near: sort/skip gate-list 7 > print gate-list > > Where's the error? Sort works without the skip. Why not with it? >
What does MY-DATA look like? Is it a block whose length is a multiple of 7, or is it a block of 7-element blocks? In the former case, SORT/SKIP...7 should work, but in the latter case it would cough blood...
>> blk: []
== []
>> repeat i 5 [append blk i loop 6 [append blk random 1000]]
== [1 695 852 380 196 367 232 2 853 912 304 415 171 632 3 767 530 257 786 935 620 4 566 441 445 704 719 260 5 715 897 556 599 936 6...
>> sort/skip/compare blk 7 2
== [4 566 441 445 704 719 260 1 695 852 380 196 367 232 5 715 897 556 599 936 666 3 767 530 257 786 935 620 2 853 912 304 415 171 6...
>> sort/skip blk 7
== [1 695 852 380 196 367 232 2 853 912 304 415 171 632 3 767 530 257 786 935 620 4 566 441 445 704 719 260 5 715 897 556 599 936 6... in contrast with...
>> blk: []
== []
>> repeat i 5 [
use [bb] [ bb: reduce [i] loop 6 [append bb random 1000] append/only blk bb ] ] == [[1 728 199 380 334 451 455] [2 733 167 650 919 639 73] [3 756 674 806 534 37 942] [4 60 458 444 710 416 518] [5 839 601 379 559...
>> sort/skip/compare blk 7 2
** Script Error: Invalid argument: 7 ** Where: halt-view ** Near: sort/skip/compare blk 7 2 HTH! -jn- -- This sentence contradicts itself -- no actually it doesn't. -- Doug Hofstadter joel<dot>neely<at>fedex<dot>com