[REBOL] Re: The all function.
From: joel:neely:fedex at: 15-Apr-2002 8:17
Hi, Anton and Louis,
Thanks, Anton, for bypassing my goof!
Anton wrote:
> Use this instead:
>
> find/skip database reduce [key1 key2] 3
>
> The skip refinement treats the series as records
> of fixed number of objects, which is 3 in this case
> (2 keys and 1 object).
>
Doh!
You're right, of course! I spoke too hastily when I said there
would be a need for a loop.
If I had thought more carefully, I would have realized that my
bias toward *ALWAYS* having a unique key was influencing my
thinking.
After further thought, I'd ask another design question:
Are the values of CODE and CHKNUM guaranteed to be immutable
over the life of an object?
If so, then the "concatenated key" approach has a slight edge
in performance, I believe.
If not, then the work required to keep the key (or keys, for
the FIND/SKIP version) up to date.
-jn-
--
; Joel Neely joeldotneelyatfedexdotcom
REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip
do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] {
| e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]