Selects
[1/1] from: andrew::martin::colenso::school::nz at: 13-Aug-2003 12:12
Nifty function of the day strikes again!
Selects: function [
"Repeatedly finds a value in the series and returns the value or
series after it."
Series [series! port!]
Values [block!]
/Part "Limits the search to a given length or position."
Range [number! series! port!]
/Only "Treats a series value as a single value."
/Case "Characters are case-sensitive."
/Any "Enables the * and ? wildcards."
/With "Allows custom wildcards."
Wild [string!] {Specifies alternates for "*" and "?".}
/Skip "Treat the series as records of fixed size."
] [
Body
] [
Body: reduce [
foreach Refinement first :Selects collect/initial [
if equal? /local Refinement [
break
]
all [
refinement? Refinement
get bind Refinement: to word! Refinement 'Body
Refinement
]
] to path! 'Select
'Series 'Value
]
all [
Part
insert/only tail Body Range
]
all [
With
insert/only tail Body Wild
]
foreach Value Values collect Body
]
And it's used like:
>> selects/only [Pupil "Andrew Martin" DoB 25/10/2003 Foo "baa"] [Pupil
DoB]
== ["Andrew Martin" 25-Oct-2003]
Andrew J Martin
Attendance Officer &
Information Systems Trouble Shooter
Colenso High School
Arnold Street, Napier.
Tel: 64-6-8310180 ext 826
Fax: 64-6-8336759
http://colenso.net/scripts/Wiki.r?AJM
http://www.colenso.school.nz/
DISCLAIMER: Colenso High School and its Board of Trustees is not responsible (or legally
liable) for materials distributed to or acquired from user e-mail accounts. You can report
any
misuse of an e-mail account to our ICT Manager and the complaint will be investigated.
(Misuse can come in many forms, but can be viewed as any material sent/received that
indicate or suggest pornography, unethical or illegal solicitation, racism, sexism, inappropriate
language and/or other issues described in our Acceptable Use Policy.)
All outgoing messages are certified virus-free by McAfee GroupShield Exchange 5.10.285.0
Phone: +64 6 843 5095 or Fax: +64 6 833 6759 or E-mail: [postmaster--colenso--school--nz]