Numeric STRSORT, and more specialized FOR INARRAY

2 views
Skip to first unread message

John Bridges

unread,
Nov 15, 2012, 6:08:02 PM11/15/12
to after...@googlegroups.com
New build of AfterGRASP is up for download:
 
 
agsetup_20121115.exe

----------------------------------------------------------------------------
Thu, 15 November 2012

In addition to FOR INARRAY, there is now INARRAYINDEX0 and INARRAYATTRIB0.

 drawclear white
 set texthtml on
 text "<html>"
 set textwrap off
 set texthtml off
 aexample[fred][0][zed] = a
 aexample[fred][1][zed] = b
 aexample[fred][2][zed] = c
 bexample[fred][zed] = z
 testi0 &aexample[fred]
 testi0 &bexample[fred]
 wait
 exitnow
 
 testi0:
   declare a
   for i inarrayindex0 &a
   textln @a[@i]$" "$@i
   next
   return
 
----------------------------------------------------------------------------
Wed, 14 November 2012

STRSORT with Numeric option now compares groups of numbers, previously it
only compared the first number found in each string.

Given this list:
  abba2_22
  abba2_213
  abba12_3
  abba9_9

Without numeric option will sort as
  abba12_3
  abba2_22
  abba2_213
  abba9_9

With numeric option will sort as
  abba2_22
  abba2_213
  abba9_9
  abba12_3

----------------------------------------------------------------------------
Tue, 13 November 2012

In addition to FOR INARRAY, there is now INARRAYINDEX and INARRAYATTRIB.

  FOR VAR INARRAYINDEX ARRAY
  ...
  NEXT
 
  FOR VAR INARRAYINDEX ARRAY
  ...
  NEXT
 
INARRAYINDEX gives all the index values from an array, so for instance
instead of this:

  for idx from 0 count myarray->size
 
You can write this now as:

  for idx inarrayindex &myarray
 

And instead of:

  for atr inarray array(arrayindex(&myarray))
 
 You can now write:
 
  for atr inarrayattrib &myarray
 
   

----------------------------------------------------------------------------

Reply all
Reply to author
Forward
0 new messages