📖
Rede Language Design
  • Overview
    • Introduction
    • Scope
    • Terms and Definitions
  • Annexes
    • Annex A - Complete Grammar
    • Annex B - Symbols and Keywords
    • Annex C - Code Examples
      • Behaviors
      • Comments
      • Crashes
      • Data Types
        • Built-in Types
          • Context Collections
            • Buckets
            • Compositions
              • Registrations
              • Deregistrations
            • Operables
          • Primitives
          • Value Collections
            • Arrays
            • Dictionaries
            • Lists
            • Sets
            • Tuples
        • Custom Types
      • Evaluation
      • Mappings
      • Meta
      • Operations
        • Groups
      • Patterns
    • Annex D - Program Examples
      • Hello World
      • FizzBuzz
      • Fibonacci
      • Shape Drawing
      • Deserialization
      • Serialization
Powered by GitBook
On this page
  • Type Declaration
  • Operators
  • Accessing
  • Difference (Remove Elements)
  • Filter
  • Intersection
  • Sort
  • Union (Appending)
  • As Variables
  • Assignment
  • Declaration
  1. Annexes
  2. Annex C - Code Examples
  3. Data Types
  4. Built-in Types
  5. Context Collections

Buckets

The following code examples demonstrate the built-in bucket type offered by the language. See section [TBD] for details.

Type Declaration

Specific Bucket Name: {*Context Type*}.

Operators

Accessing

Containment

some bucket: {*Context Type*} [context a, context b];

`Index checks.`
some bucket(1?) = true
some bucket(2?) = false

`ID checks.`
some bucket(context a id?) = true
some bucket(context c id?) = false
some bucket: {*Context Type*} [context a, context b];
some bucket(1?, context c id?) = {true, false}

Retrieving

some bucket: {*Context Type*} [context a, context b];
some bucket(0) = {*context a*}
some bucket(context b id) = {*context b*}
some bucket: {*Context Type*} [context a, context b];
some bucket(...) = {*context a, context b*}  `Total collection accessor.`

Difference (Remove Elements)

{*context a, context b*} - {*context b, context c*} = {*context a*}

Filter

`Filter for a Behavior.`
`Generic 'T' is treated as the defined type, Base Context.`

Manage {*T*} (T [Base Context]): {contexts},
    where contexts filtered by [(a) => a meets criteria]?
    
    `Behavior Operations.`
`Filter for an Operation.`
Update {*Context Type*}: <contexts>,
    where positive contexts is contexts filtered by [(a) => a(Value A) > 0],
    where negative contexts is contexts filtered by [(a) => a(Value A) < 0],
    when |positive contexts| > 0 and |negative contexts| > 0?
    
    `Operation Logic.`

Intersection

{*context a, context b*} % {*context b, context c*} = {*context b*}

Sort

`Sort for a Behavior.`
`Generic 'T' is treated as the defined type, Base Context.`

Manage {*T*} (T [Base Context]): {contexts},
    where contexts sorted by [(a, b => a - b]?
    
    `Behavior Operations.`
`Sort for an Operation.`
Update {*Context Type*}: <contexts>,
    where ordered contexts is contexts sorted by [(a, b) => a - b],
    where reversed contexts is contexts sorted by [(a, b) => b - a]?
    
    `Operation Logic.`

Union (Appending)

{*context a, context b*} + {*context b, context c*} = 
    {*context a, context b, context c*}

As Variables

Assignment

some bucket is {*context a, context b*},
some operable is {*context a, context b*} + {*context b, context c*},

Declaration

some bucket: {*Context Type*} [context a, context b];
specific bucket: Specific Bucket Name [context a, context b];
some bucket: {*Context Type*} [{*context a, context b*} + {*context b, context c*}];
PreviousContext CollectionsNextCompositions

Last updated 1 year ago