Does anyone have suggestions on how to improve the function below?

TIA,
Kai

The 'filter function below returns a result block containing only "records"=
 having
the filter criterion crit in "column" column



filter: function [ cursor [block!] reclen [integer!] column [integer!] crit=
 ] [ rec result tmp ] [
   ;
   result: make block! length? cursor
   crit:    to-string crit
   ;
   forskip cursor reclen [ 
      rec: copy/part cursor reclen 
      ; 
      if none <> find to-string cursor/:column crit [ insert tail result rec=
 ]
   ]
   result
]

s: s: [ 100   "Jim"    45 
         201   "Bob"    52 
         325   "Will"    16 ]

probe filter s 3 2 "i" ; filter for names containing letter "i"
-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to