angerangel edited this page Jan 2, 2013 · 1 revision

Table of Contents

USAGE

  ALTER series value /case

DESCRIPTION

Append value if not found, else remove it; returns true if added. ALTER is a function value.

ARGUMENTS

  • series -- (modified) (series! port! bitset!)
  • value

REFINEMENTS

  • /case -- Case-sensitive comparison

SOURCE

alter: make function! [  [
    {Append value if not found, else remove it; returns true if added.}
    series [series! port! bitset!] "(modified)"
    value
    /case "Case-sensitive comparison"
][
    if bitset? series [
        return either find series :value [
            remove/part series :value false
        ] [
            append series :value true
        ]
    ]
    found? unless remove (
        either case [find/case series :value] [find series :value]
    ) [append series :value]
] ] 
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.