Documentation for Module: functional.r ||  Module Index

syntax: !overview Functional and control block operations
author: Tim Johnson tim@akwebsoft.com

Global Index
Accrue conde doskip for-every pif
arguments do-if dotimes forline static
case do-ifn every forstep unless
cfor do-with-data export fortype yield
cond doall filter map  

Global function documentation

Function: AccrueTopGlobals IndexNext
    syntax: Accrue <any-type-start> <series> <function>
    description: Accumulates values in a block by successively applying
    the function to each value in Series.
    example: Accrue 0 [1 2 3 4 5] :+ ==>> 15
    Function: takes two parameters, Accumulator and Item.
Function: argumentsTopGlobals IndexBackNext
    syntax: arguments <functions>
    description: Returns the arguments of the function as a block of word! values.
Function: caseTopGlobals IndexBackNext
    syntax: case <block-of-cases> Find a condition and evaluates what follows it.
    Refinement: /default Default case if no others are found.
Function: cforTopGlobals IndexBackNext
    syntax: cfor <init-block> <test-block> <increment-block> <code-block>
    description: C-like for function.
    example: cfor [i: 1] [i <= 2000] [i: i + i] [print i]
Function: condTopGlobals IndexBackNext
    syntax: cond <block-of-conditions-and-code>
    description: Control block to process one of logical true. No default block.
Function: condeTopGlobals IndexBackNext
    syntax: conde <block-of-conditions-and-code> <block-default>
    description: Control block to process one of logical true. Default block.
Function: do-ifTopGlobals IndexBackNext
    syntax: do-if <word> <code-block> Evaluate code block if word has a value.
Function: do-ifnTopGlobals IndexBackNext
    syntax: do-ifn <word> <code-block> Evaluate code block if word has none value.
Function: do-with-dataTopGlobals IndexBackNext
    syntax: do-with-data <block-cases>
    description: Evaluates any code following any expression that evaluates to true
    by the has-data? test. **see docs for has-data?**
    description: Accumulates return values of code (if set).
    description: Returns a block if at least one code set is evaluated.
    description: If no code block is evaluated, returns false.
    Note: Block returned may be empty if all code blocks evaluated return unset values.
Function: doallTopGlobals IndexBackNext
    syntax: doall <word> <start-index> <code-block> Like foreall, but cumulative
    description: Evaluates a block for every value in a series. Accumulates results.
    Return: results, Resets block.
    needs: starting point of 0 or greater.
    refinement: /full add none results
Function: doskipTopGlobals IndexBackNext
    syntax: doskip <series-word> <skip-num> <start> <code-block> cumulative forskip
    description: Evaluates a block for periodic values in a series.
    return: Accumulated results, resets word to head.
    refinement: /full accumulate none values
Function: dotimesTopGlobals IndexBackNext
    syntax: dotimes <int-series-none-logic-control> <code-block>
    description: Evaluates a block a specified number of times, value or length
    of control. If control is logic or none, do nothing
Function: everyTopGlobals IndexBackNext
    syntax: every <block-of-cases>
    description: Evaluates any code following any expression that is not FALSE or NONE.
    description: Accumulates return values of code (if set).
    description: Returns a block if at least one code set is evaluated.
    description: If no code block is evaluated, returns false.
    description: Block returned may be empty if all code blocks evaluated return unset values.
Function: exportTopGlobals IndexBackNext
    syntax: export <block-of-words> Export local words in the global context.
    refinement: /to Export to this object instead of SYSTEM/WORDS
Function: filterTopGlobals IndexBackNext
    syntax: filter <function> <series> Filter a block.
    note: Filtering function must return true for element that should be selected.
Function: for-everyTopGlobals IndexBackNext
    syntax: for-every <blk> <code-block>
    Description: Evaluates a block for each value(s) in one or more series values.
     A multiple foreach.
    example: for-every[val vals label labels rj rjs][ do-code]
      where the first of each pair is an auto-generated pointer
      and the second is a previously-defined series.
Function: forlineTopGlobals IndexBackNext
    syntax: forline <line> <file-str> <code-block> For each line in file do code
    refinement?: /nobuffer use unbuffered for speed
Function: forstepTopGlobals IndexBackNext
    syntax: forstep <word-block> <skip-num> <code-block> cumulative foreach
    description: Evaluates a block for periodic values in a series.
    breaks: if number of elements remaining are less than skip-num
    Note: Block is reset to head when done.
    refinement: /even Throw error if length of word not aligned to skip-num
    refinement: Do nt add none values
Function: fortypeTopGlobals IndexBackNext
    syntax: fortype <type-datatype> <block> <function>
    Description: Evaluate a function for each value of a given datatype in a block
    example: fortype word! to-block words func [word][set/any in dest word get/any word]
Function: mapTopGlobals IndexBackNext
    syntax: map <function-series> <function-series>
    description: Maps or applies a function to all elements of the series.
    refinement: /only Inserts the result of the function as a series.
    refinement: /full Do not ignore none! value.
    refinement: /with <sep> insert between elements of the series. If block, alternate elements
Function: pifTopGlobals IndexBackNext
    syntax: pif <block> Polymorphic If: lazy evaluation, no default (use True guard instead).
    description: If/Either compatibility:
      guard checking (unset not allowed), non-logic guards allowed,
       block checking (after a guard only a block allowed), computed blocks allowed
       Return working, Exit working, Break working
Function: staticTopGlobals IndexBackNext
    syntax: static <vars-block> <function>
    description: Create function with block of static vars with initial values
    example: count: static [n: 0] does [n: n + 1]
    example: factorial: static [] func [n][either n < 2 [1][n * self n - 1]]
Function: unlessTopGlobals IndexBackNext
    syntax: unless <boolean-condition> <code-block>
    description: Evaluate a block if the condition is *NOT* true
Function: yieldTopGlobals IndexBack
    syntax: yield <block> Collects the results of block evaluations.
    Arg: Block to do
    refinement: /only Inserts the result as a series.
    refinement: /full Do not ignore none! values.
    refinement: /initial <type> Specifies the type of the result.
    refinement: /str Return as string. NOTE: can always rejoin block Result.

Global function documentation