# or_all

Definition: | atom res = or_all(object s)
Description: | Apply or_bits to all elements of a sequence. s: an atom, or a sequence, all elements of which are processed. Returns an atom, either atom s unaltered or the result of applying or_bits() to all elements of s.
pwa/p2js: | Supported.
Comments: | This function may be applied to an atom or to all elements of a sequence. In the latter case it performs or_bits() operations repeatedly. Many low-level operations, especially machine-specific API, require a bit field, whereby several options are represented by bit settings in a single parameter, rather than being passed as a much larger number of separate parameters. As long as all bit settings are unique, and no elements contain fractions that would spill over or otherwise skew the results, the result will be the same as simply adding the elements together, however if any bits are duplicated the result of adding them would be completely wrong, whereas or_all handles that properly. Compatibility Note: This is not recursive, unlike the Euphoria version of this routine, but will instead trigger an error, quite deliberately, should any nested sub-sequences be found. There is an or_allu() version that uses or_bitsu() instead, should you require an unsigned result.
Example 1: |
    or_all(0b0010)                          -- 0b0000010
    or_all({0b0010, 0b1000, 0b0100000})     -- 0b0101010
    fhandle = c_func(xCreateFile,{name,or_all(GENERIC_READ,GENERIC_WRITE),...)
Implementation: | See builtins\porall.e (an autoinclude) for details of the actual implementation.
See Also: | or_bits