[REBOL] Re: Exclude Problems
From: learned:talentsinc at: 28-Sep-2001 10:05
Thanks, I need to study this code a bit...when things relate to a real
world situation it's a lot easier for me to grok. I do have a question
though...in theory, this could be done by redefining exclude as well by
adding an exclude/only modifier...am I right?
Not asking for it, just trying to understand all the options.
Thanks again!
--On Friday, September 28, 2001 5:50 AM -0700 Ammon Cooke
<[ammoncooke--yahoo--com]> wrote:
> Oh, I didn't catch that. Here's the fixed code!
>
> excl-only: func [
> "This is the Exclude function that doesn't exclude duplicates"
> block1 "The original block"
> block2 "The block to be 'excluded'"
> ][
> tmp-block: copy block1
> either (length? b) > 1[
> repeat val block2 [remove find tmp-block val]
> ][
> remove find tmp-block block2
> ]
> either not none? tmp-block[
> return head tmp-block
> ][
> return tmp-block
> ]
> ]
>
> Enjoy!!
> Ammon
>
> ----- Original Message -----
> From: "G. Edw. Learned" <[learned--talentsinc--net]>
> To: <[rebol-list--rebol--com]>
> Sent: Thursday, September 27, 2001 12:45 PM
> Subject: [REBOL] Re: Exclude Problems
>
>> That seems to work only if block 2 has only one item in it. I need to
>> play with it some more I think.
>>
>> --On Thursday, September 27, 2001 1:25 PM -0700 Ammon Cooke
>> <[ammoncooke--yahoo--com]> wrote:
>>
>> > Here:
>> >
>> > excl-only: func [
>> > "This is the Exclude function that doesn't exclude duplicates"
>> > block1 "The original block"
>> > block2 "The block to be 'excluded'"
>> > ][
>> > tmp-block: [none]
>> > tmp-block: remove find copy block1 copy block2
>> > either not none? tmp-block[
>> > return head tmp-block
>> > ][
>> > return tmp-block
>> > ]
>> > ]
>> >
>> > HTH!
>> > Ammon
>> >
>> > ----- Original Message -----
>> > From: "G. Edw. Learned" <[learned--talentsinc--net]>
>> > To: <[rebol-list--rebol--com]>
>> > Sent: Thursday, September 27, 2001 7:12 AM
>> > Subject: [REBOL] Re: Exclude Problems
>> >
>> >
>> >> Argh, I just tested and yes, that's it exactly. I didn't see that
> little
>> >> "feature" documented in the dictionary at the REBOL site. Thanks. Is
>> >> there a better source of documentation that I should get other than
>> >> the online word dictionary?
>> >>
>> >> On the bad side, it just made exclude totally useless for my project.
>> >> I don't suppose that remove duplicate is an optional feature? Guess
>> >> I'm back to remove.
>> >>
>> >> --On Thursday, September 27, 2001 5:23 PM +1000 Allen Kamp
>> >> <[allenk--powerup--com--au]> wrote:
>> >>
>> >> >
>> >> > ----- Original Message -----
>> >> > From: "G. Edw. Learned" <[learned--talentsinc--net]>
>> >> > To: <[rebol-list--rebol--com]>
>> >> > Sent: Thursday, September 27, 2001 8:08 AM
>> >> > Subject: [REBOL] Re: Exclude Problems
>> >> >
>> >> >
>> >> >> I thought that too, which is why I reduced it down to excluding
>> >> >> just
>> > one
>> >> >> item, SYSTEM, and it still took out words like SEAGATE and strings
>> >> >> like "----". Is a puzzlement.
>> >> >
>> >> > Exclude also cleans up duplicate entries, such as.
>> >> >>> exclude ["AA" "B" "C" "D" "E" "AA" "F" "G" "AA" "B" "AA" "B"] ["C"
>> > "F"]
>> >> > == ["AA" "B" "D" "E" "G"]
>> >> >
>> >> > Could that explain what you are seeing?
>> >> >
>> >> > Cheers,
>> >> >
>> >> > Allen K
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > To unsubscribe from this list, please send an email to
>> >> > [rebol-request--rebol--com] with "unsubscribe" in the
>> >> > subject, without the quotes.
>> >>
>> >>
>> >>
>> >> ---
>> >> G. Edw. Learned - [learned--talentsinc--net]
>> >> (Never apply a Star Trek Solution to a Babylon Five Problem)
>> >> --
>> >> To unsubscribe from this list, please send an email to
>> >> [rebol-request--rebol--com] with "unsubscribe" in the
>> >> subject, without the quotes.
>> >
>> > --
>> > To unsubscribe from this list, please send an email to
>> > [rebol-request--rebol--com] with "unsubscribe" in the
>> > subject, without the quotes.
>>
>>
>>
>> ---
>> G. Edw. Learned - [learned--talentsinc--net]
>> (Never apply a Star Trek Solution to a Babylon Five Problem)
>> --
>> To unsubscribe from this list, please send an email to
>> [rebol-request--rebol--com] with "unsubscribe" in the
>> subject, without the quotes.
>
> --
> To unsubscribe from this list, please send an email to
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
---
G. Edw. Learned - [learned--talentsinc--net]
(Never apply a Star Trek Solution to a Babylon Five Problem)