RE: Re: Speed test

new topic     » topic index » view thread      » older message » newer message

> From: rforno at tutopia.com
> To: EUforum <EUforum at topica.com>
> Reply-To: EUforum at topica.com
> Subject: Re: Speed test
> Date: 2/09/2001 12:53:39 PM
> 
> 
> I'm afraid I don't understand what do you 
> call "vertical slicing". If one
> uses parallel sequences, let's say x, y, 
> z, then there is only one way to
> refer to each element of these, namely x
> [i], etc. Please give an example of
> what you mean.
> Regards.
> ----- Original Message -----
> From: "Derek Parnell" 
> <ddparnell at bigpond.com>
> To: "EUforum" <EUforum at topica.com>
> Sent: Saturday, September 01, 2001 9:43 PM
> Subject: Re: Speed test
> 
> 
> > Yes, I often use parallel lists too. 
> Vertical slicing becomes an issue
> then.
> > Pity we don't have any neat ways of do 
> that yet.
> >

I'm sorry about the obscure reference. By the term "vertical slice", I'm
referring to the ability to create a new sequence based on the n'th element
of a set of sequences.

Two forms of this come to immediate mind...
a) Where you have a disjoint set of sequences eg x,y,z.

   sequence result
   result = vertslice( {x,y,z}, 2)

which would set the 'result' sequence to have three elements, namely the 2nd
element of x,y, and z respectively.

b) Where you manage a set of related sequences that are already contained in
a sequence.

   sequence result
   result = vertslice( x, 2)
which would set the 'result' sequence to length(x) elements, namely the 2nd
element of each subsequence of x.

As you can see, the two are very similar with the only difference being how
your program manages the subsequences.

My use of parallel sequences is mainly so that I can use the fast 'find()'
function rather than loop through subsequences. For example:

Say I have a set of accounts. Each account has a few fields: acctno,
startdate, currbal, custno.

I could store this as a single sequence with each subsequence representing a
record, thus...

   sequence accounts
   accounts = {{123, 20010831, 5432.10, 99832}, 
               {234, 20010630, 1092.95, 89983},
               {345, 20010111, 99.99, 99382}
              }

but then searching for customer numbers is a bit slow as I can't use find
effciently.

An alternate is to store the records "vertically".
    sequence acctno, startdate, currbal, custno

    acctno = {123,234,345}
    startdate = {20010831, 20010630, 20010111}
    currbal = {5432.10, 1092.95, 99.99}
    custno = {99832, 89983, 99382}

This allows me to use find() to quickly locate a customer number. And
vertical slicing would be used to get the complete account record for that
customer.

    theCust = find(89983, custno)
    accRecord = vertslice( {acctno, startdate, currbal, custno}, theCust)

The main problem with keeping disjoint sequences in this manner is that
updating them becomes a bit of a quality headache. If the individual "field"
sequences were kept in a "file" sequence, then updating becomes a little
simpler.

    accounts = {{123,234,345},
                {20010831, 20010630, 20010111},
                {5432.10, 1092.95, 99.99},
                {99832, 89983, 99382}
               }

    accounts = vertupdate( accounts, theCust, updateRecord)

this way, the "vertupdate()" routine doesn't have to know the names of the
fields.

-----
Derek.


--------------------------------------------------------------------
Global Technology Australasia Limited is the industry leader in next
generation financial software solutions: www.glotec.com.au
Delivering the Future of Banking Today
CAUTION - This email and any files attached may contain privileged and
confidential information intended solely for the use of the individual or
entity to whom they are addressed. If you are not the intended recipient of
this message you are hereby notified that any use, dissemination,
distribution or reproduction of this message is prohibited. If you have
received this message in error please notify the sender immediately. Any
views expressed in this message are those of the individual sender and may
not necessarily reflect the views of Global Technology Australasia Limited.
--------------------------------------------------------------------

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu