REBOL Document

Difference - Function Summary


Summary:

Return the difference of two data sets.

Usage:

difference set1 set2

Arguments:

set1 - First data set (must be: series bitset date)

set2 - Second data set (must be: series bitset date)

Refinements:

/case - Uses case-sensitive comparison.

/skip - Treat the series as records of fixed size

size - The size argument. (must be: integer)

Description:

Returns the elements of two series that are not present in both. Newer versions of REBOL also let you use DIFFERENCE to compute the difference between date/times.


    lunch: [ham cheese bread carrot]
    dinner: [ham salad carrot rice]
    probe difference lunch dinner
    [cheese bread salad rice]


    probe difference [1 3 2 4] [3 5 4 6]
    [1 2 5 6]


    string1: "CBAD"    ; A B C D scrambled
    string2: "EDCF"    ; C D E F scrambled
    probe difference string1 string2
    "BAEF"

Date differences produce a time in hours:


    probe difference 1-Jan-2002/0:00 1-Feb-2002/0:00
    -744:00


    probe difference 1-Jan-2003/10:30 now
    -10390:29:49

There is a limit to the time period that can be differenced between dates (determined by the internal size of the TIME datatype).

Note that performing this function over very large data sets can be CPU intensive.

Related:

intersect - Create a new value that is the intersection of the two arguments.
union - Creates a new set that is the union of the two arguments.


<Back | Index | Next>

Copyright 2004 REBOL Technologies