mini_kraken 0.1.12 → 0.2.03
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.rubocop.yml +334 -0
 - data/CHANGELOG.md +54 -0
 - data/README.md +95 -13
 - data/lib/mini_kraken.rb +7 -1
 - data/lib/mini_kraken/core/any_value.rb +5 -1
 - data/lib/mini_kraken/core/atomic_term.rb +1 -0
 - data/lib/mini_kraken/core/conde.rb +1 -1
 - data/lib/mini_kraken/core/conj2.rb +3 -3
 - data/lib/mini_kraken/core/cons_cell.rb +29 -1
 - data/lib/mini_kraken/core/cons_cell_visitor.rb +102 -0
 - data/lib/mini_kraken/core/def_relation.rb +4 -0
 - data/lib/mini_kraken/core/disj2.rb +2 -2
 - data/lib/mini_kraken/core/environment.rb +2 -2
 - data/lib/mini_kraken/core/equals.rb +60 -26
 - data/lib/mini_kraken/core/formal_ref.rb +2 -1
 - data/lib/mini_kraken/core/goal.rb +4 -2
 - data/lib/mini_kraken/core/goal_template.rb +44 -2
 - data/lib/mini_kraken/core/k_boolean.rb +4 -0
 - data/lib/mini_kraken/core/k_symbol.rb +11 -0
 - data/lib/mini_kraken/core/outcome.rb +11 -1
 - data/lib/mini_kraken/core/variable.rb +10 -4
 - data/lib/mini_kraken/core/variable_ref.rb +7 -0
 - data/lib/mini_kraken/core/vocabulary.rb +8 -3
 - data/lib/mini_kraken/glue/dsl.rb +236 -0
 - data/lib/mini_kraken/glue/fresh_env.rb +31 -3
 - data/lib/mini_kraken/glue/fresh_env_factory.rb +83 -0
 - data/lib/mini_kraken/glue/run_star_expression.rb +3 -5
 - data/lib/mini_kraken/version.rb +1 -1
 - data/mini_kraken.gemspec +6 -3
 - data/spec/.rubocop.yml +13 -0
 - data/spec/core/conde_spec.rb +10 -10
 - data/spec/core/conj2_spec.rb +7 -7
 - data/spec/core/cons_cell_spec.rb +35 -0
 - data/spec/core/cons_cell_visitor_spec.rb +144 -0
 - data/spec/core/def_relation_spec.rb +6 -5
 - data/spec/core/disj2_spec.rb +5 -5
 - data/spec/core/duck_fiber_spec.rb +2 -2
 - data/spec/core/equals_spec.rb +34 -21
 - data/spec/core/goal_spec.rb +2 -2
 - data/spec/core/k_boolean_spec.rb +6 -0
 - data/spec/core/k_symbol_spec.rb +4 -0
 - data/spec/core/outcome_spec.rb +8 -0
 - data/spec/core/variable_ref_spec.rb +3 -0
 - data/spec/glue/dsl_chap1_spec.rb +679 -0
 - data/spec/glue/dsl_chap2_spec.rb +100 -0
 - data/spec/glue/fresh_env_factory_spec.rb +97 -0
 - data/spec/glue/run_star_expression_spec.rb +11 -11
 - metadata +17 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 6ae3703cbb0a7a854af490478227c915d7d9af72715be80cbd4e3c95cb7b2c3f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 27e04d428e1015f176fbafba7c047a0b12c28e9150161a7a5702190c8dd2e2e9
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: bd9cd60953f88610ce3a5009e0cad4099e1896643ad01f1c6616a4c20fb4495a71f5c5ed11efe98873362055bda2ec9d0ba4a1ce972844588cacab528ac5333d
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 1c9d27a9fb7fa014f9789a159aff5309bd9c03ce810e994951373ee550698518683359815c4db43b9d95b00ba889670b824af18c1019af5442f2ca3b42c795ba
         
     | 
    
        data/.rubocop.yml
    ADDED
    
    | 
         @@ -0,0 +1,334 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            AllCops:
         
     | 
| 
      
 2 
     | 
    
         
            +
              Exclude:
         
     | 
| 
      
 3 
     | 
    
         
            +
                - 'exp/**/*'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Layout/ArgumentAlignment:
         
     | 
| 
      
 6 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            Layout/ArrayAlignment:
         
     | 
| 
      
 9 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 10 
     | 
    
         
            +
              EnforcedStyle: with_fixed_indentation
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            Layout/CaseIndentation:
         
     | 
| 
      
 13 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            Layout/ClosingHeredocIndentation:
         
     | 
| 
      
 16 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            Layout/CommentIndentation:
         
     | 
| 
      
 19 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            Layout/ElseAlignment:
         
     | 
| 
      
 22 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            Layout/EmptyLines:
         
     | 
| 
      
 25 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            Layout/EndAlignment:
         
     | 
| 
      
 28 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            Layout/EndOfLine:
         
     | 
| 
      
 31 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 32 
     | 
    
         
            +
              EnforcedStyle: lf
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            Layout/FirstArgumentIndentation:
         
     | 
| 
      
 35 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            Layout/IndentationWidth:
         
     | 
| 
      
 38 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
            Layout/IndentationConsistency:
         
     | 
| 
      
 41 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            Layout/HeredocIndentation:
         
     | 
| 
      
 44 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            Layout/MultilineHashBraceLayout:
         
     | 
| 
      
 47 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 48 
     | 
    
         
            +
              
         
     | 
| 
      
 49 
     | 
    
         
            +
            Layout/MultilineMethodCallBraceLayout:
         
     | 
| 
      
 50 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 51 
     | 
    
         
            +
              EnforcedStyle: same_line  
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
            Layout/SpaceAroundOperators:
         
     | 
| 
      
 54 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            Layout/SpaceInsideParens:
         
     | 
| 
      
 57 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            Layout/IndentationStyle:
         
     | 
| 
      
 60 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 61 
     | 
    
         
            +
              
         
     | 
| 
      
 62 
     | 
    
         
            +
            Layout/SpaceAroundMethodCallOperator:
         
     | 
| 
      
 63 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            Layout/TrailingEmptyLines:
         
     | 
| 
      
 66 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
            Layout/TrailingWhitespace:
         
     | 
| 
      
 69 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
            Lint/Loop:
         
     | 
| 
      
 72 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 73 
     | 
    
         
            +
              
         
     | 
| 
      
 74 
     | 
    
         
            +
            Lint/RaiseException:
         
     | 
| 
      
 75 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
            Lint/RescueException:
         
     | 
| 
      
 78 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 79 
     | 
    
         
            +
              
         
     | 
| 
      
 80 
     | 
    
         
            +
            Lint/StructNewOverride:
         
     | 
| 
      
 81 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
            Lint/UnusedMethodArgument:
         
     | 
| 
      
 84 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
            Lint/UselessAccessModifier:
         
     | 
| 
      
 87 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
            Lint/Void:
         
     | 
| 
      
 90 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
            Lint/UselessAssignment:
         
     | 
| 
      
 93 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
            Metrics/AbcSize:
         
     | 
| 
      
 96 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
      
 98 
     | 
    
         
            +
            Metrics/BlockLength:
         
     | 
| 
      
 99 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 100 
     | 
    
         
            +
              Max: 350
         
     | 
| 
      
 101 
     | 
    
         
            +
              
         
     | 
| 
      
 102 
     | 
    
         
            +
            Metrics/BlockNesting:
         
     | 
| 
      
 103 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 104 
     | 
    
         
            +
              Max: 5
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
            Metrics/ClassLength:
         
     | 
| 
      
 107 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 108 
     | 
    
         
            +
              Max: 350
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
            Metrics/CyclomaticComplexity:
         
     | 
| 
      
 111 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
            Layout/LineLength:
         
     | 
| 
      
 114 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 115 
     | 
    
         
            +
              Max: 90
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
            Metrics/MethodLength:
         
     | 
| 
      
 118 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 119 
     | 
    
         
            +
              Max: 50
         
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
      
 121 
     | 
    
         
            +
            Metrics/ModuleLength:
         
     | 
| 
      
 122 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 123 
     | 
    
         
            +
              Max: 500
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
            Metrics/PerceivedComplexity:
         
     | 
| 
      
 126 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
            Naming/ConstantName:
         
     | 
| 
      
 129 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
            Naming/ClassAndModuleCamelCase:
         
     | 
| 
      
 132 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 133 
     | 
    
         
            +
             
     | 
| 
      
 134 
     | 
    
         
            +
            Naming/BlockParameterName:
         
     | 
| 
      
 135 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
      
 137 
     | 
    
         
            +
            Naming/MethodParameterName:
         
     | 
| 
      
 138 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
            Naming/VariableName:
         
     | 
| 
      
 141 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
      
 143 
     | 
    
         
            +
            Style/Alias:
         
     | 
| 
      
 144 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
            Layout/HashAlignment:
         
     | 
| 
      
 147 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
      
 149 
     | 
    
         
            +
            Style/AsciiComments:
         
     | 
| 
      
 150 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 151 
     | 
    
         
            +
             
     | 
| 
      
 152 
     | 
    
         
            +
            Style/BarePercentLiterals:
         
     | 
| 
      
 153 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 154 
     | 
    
         
            +
             
     | 
| 
      
 155 
     | 
    
         
            +
            Style/BlockComments:
         
     | 
| 
      
 156 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 157 
     | 
    
         
            +
             
     | 
| 
      
 158 
     | 
    
         
            +
            Style/CharacterLiteral:
         
     | 
| 
      
 159 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 160 
     | 
    
         
            +
             
     | 
| 
      
 161 
     | 
    
         
            +
            Style/ClassCheck:
         
     | 
| 
      
 162 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 163 
     | 
    
         
            +
             
     | 
| 
      
 164 
     | 
    
         
            +
            Style/ClassVars:
         
     | 
| 
      
 165 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 166 
     | 
    
         
            +
             
     | 
| 
      
 167 
     | 
    
         
            +
            Style/ColonMethodCall:
         
     | 
| 
      
 168 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
      
 170 
     | 
    
         
            +
            Style/CommentAnnotation:
         
     | 
| 
      
 171 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
      
 173 
     | 
    
         
            +
            Style/CommentedKeyword:
         
     | 
| 
      
 174 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 175 
     | 
    
         
            +
             
     | 
| 
      
 176 
     | 
    
         
            +
            Style/ConditionalAssignment:
         
     | 
| 
      
 177 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 178 
     | 
    
         
            +
             
     | 
| 
      
 179 
     | 
    
         
            +
            Style/DefWithParentheses:
         
     | 
| 
      
 180 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 181 
     | 
    
         
            +
             
     | 
| 
      
 182 
     | 
    
         
            +
            Style/Documentation:
         
     | 
| 
      
 183 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 184 
     | 
    
         
            +
             
     | 
| 
      
 185 
     | 
    
         
            +
            Style/ExpandPathArguments:
         
     | 
| 
      
 186 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 187 
     | 
    
         
            +
              
         
     | 
| 
      
 188 
     | 
    
         
            +
            Style/ExponentialNotation:
         
     | 
| 
      
 189 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 190 
     | 
    
         
            +
             
     | 
| 
      
 191 
     | 
    
         
            +
            Style/GuardClause:
         
     | 
| 
      
 192 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 193 
     | 
    
         
            +
              
         
     | 
| 
      
 194 
     | 
    
         
            +
            Style/HashEachMethods:
         
     | 
| 
      
 195 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 196 
     | 
    
         
            +
              
         
     | 
| 
      
 197 
     | 
    
         
            +
            Style/HashTransformKeys:
         
     | 
| 
      
 198 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 199 
     | 
    
         
            +
              
         
     | 
| 
      
 200 
     | 
    
         
            +
            Style/HashTransformValues:
         
     | 
| 
      
 201 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 202 
     | 
    
         
            +
             
     | 
| 
      
 203 
     | 
    
         
            +
            Style/IfUnlessModifier:
         
     | 
| 
      
 204 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 205 
     | 
    
         
            +
             
     | 
| 
      
 206 
     | 
    
         
            +
            Style/InverseMethods:
         
     | 
| 
      
 207 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 208 
     | 
    
         
            +
              
         
     | 
| 
      
 209 
     | 
    
         
            +
            Style/MissingRespondToMissing:  
         
     | 
| 
      
 210 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 211 
     | 
    
         
            +
             
     | 
| 
      
 212 
     | 
    
         
            +
            Style/Next:
         
     | 
| 
      
 213 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 214 
     | 
    
         
            +
             
     | 
| 
      
 215 
     | 
    
         
            +
            Style/NumericLiterals:
         
     | 
| 
      
 216 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 217 
     | 
    
         
            +
             
     | 
| 
      
 218 
     | 
    
         
            +
            Style/RaiseArgs:
         
     | 
| 
      
 219 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 220 
     | 
    
         
            +
             
     | 
| 
      
 221 
     | 
    
         
            +
            Style/RedundantReturn:
         
     | 
| 
      
 222 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 223 
     | 
    
         
            +
             
     | 
| 
      
 224 
     | 
    
         
            +
            Style/RedundantSelf:
         
     | 
| 
      
 225 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 226 
     | 
    
         
            +
             
     | 
| 
      
 227 
     | 
    
         
            +
            Style/RegexpLiteral:
         
     | 
| 
      
 228 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 229 
     | 
    
         
            +
             
     | 
| 
      
 230 
     | 
    
         
            +
            Style/PercentLiteralDelimiters:
         
     | 
| 
      
 231 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 232 
     | 
    
         
            +
             
     | 
| 
      
 233 
     | 
    
         
            +
            Style/StderrPuts:
         
     | 
| 
      
 234 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 235 
     | 
    
         
            +
             
     | 
| 
      
 236 
     | 
    
         
            +
            Style/StringLiterals:
         
     | 
| 
      
 237 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 238 
     | 
    
         
            +
             
     | 
| 
      
 239 
     | 
    
         
            +
            Style/TernaryParentheses:
         
     | 
| 
      
 240 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 241 
     | 
    
         
            +
             
     | 
| 
      
 242 
     | 
    
         
            +
            Style/UnlessElse:
         
     | 
| 
      
 243 
     | 
    
         
            +
              Enabled: false
         
     | 
| 
      
 244 
     | 
    
         
            +
              
         
     | 
| 
      
 245 
     | 
    
         
            +
            # Rubocop complains when it doesn't find an explicit setting for the following cops:
         
     | 
| 
      
 246 
     | 
    
         
            +
            Layout/EmptyLinesAroundAttributeAccessor:
         
     | 
| 
      
 247 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 248 
     | 
    
         
            +
             
     | 
| 
      
 249 
     | 
    
         
            +
            Lint/BinaryOperatorWithIdenticalOperands:
         
     | 
| 
      
 250 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 251 
     | 
    
         
            +
             
     | 
| 
      
 252 
     | 
    
         
            +
            Lint/DeprecatedOpenSSLConstant:
         
     | 
| 
      
 253 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 254 
     | 
    
         
            +
             
     | 
| 
      
 255 
     | 
    
         
            +
            Lint/DuplicateElsifCondition:
         
     | 
| 
      
 256 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 257 
     | 
    
         
            +
             
     | 
| 
      
 258 
     | 
    
         
            +
            Lint/DuplicateRescueException:
         
     | 
| 
      
 259 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 260 
     | 
    
         
            +
             
     | 
| 
      
 261 
     | 
    
         
            +
            Lint/EmptyConditionalBody:
         
     | 
| 
      
 262 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 263 
     | 
    
         
            +
             
     | 
| 
      
 264 
     | 
    
         
            +
            Lint/FloatComparison:
         
     | 
| 
      
 265 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 266 
     | 
    
         
            +
             
     | 
| 
      
 267 
     | 
    
         
            +
            Lint/MissingSuper:
         
     | 
| 
      
 268 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 269 
     | 
    
         
            +
             
     | 
| 
      
 270 
     | 
    
         
            +
            Lint/MixedRegexpCaptureTypes:
         
     | 
| 
      
 271 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 272 
     | 
    
         
            +
             
     | 
| 
      
 273 
     | 
    
         
            +
            Lint/OutOfRangeRegexpRef:
         
     | 
| 
      
 274 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 275 
     | 
    
         
            +
             
     | 
| 
      
 276 
     | 
    
         
            +
            Lint/SelfAssignment:
         
     | 
| 
      
 277 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 278 
     | 
    
         
            +
             
     | 
| 
      
 279 
     | 
    
         
            +
            Lint/TopLevelReturnWithArgument:
         
     | 
| 
      
 280 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 281 
     | 
    
         
            +
             
     | 
| 
      
 282 
     | 
    
         
            +
            Lint/UnreachableLoop:
         
     | 
| 
      
 283 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 284 
     | 
    
         
            +
             
     | 
| 
      
 285 
     | 
    
         
            +
            Style/AccessorGrouping:
         
     | 
| 
      
 286 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 287 
     | 
    
         
            +
             
     | 
| 
      
 288 
     | 
    
         
            +
            Style/ArrayCoercion:
         
     | 
| 
      
 289 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 290 
     | 
    
         
            +
             
     | 
| 
      
 291 
     | 
    
         
            +
            Style/BisectedAttrAccessor:
         
     | 
| 
      
 292 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 293 
     | 
    
         
            +
             
     | 
| 
      
 294 
     | 
    
         
            +
            Style/CaseLikeIf:
         
     | 
| 
      
 295 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 296 
     | 
    
         
            +
             
     | 
| 
      
 297 
     | 
    
         
            +
            Style/ExplicitBlockArgument:
         
     | 
| 
      
 298 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 299 
     | 
    
         
            +
             
     | 
| 
      
 300 
     | 
    
         
            +
            Style/GlobalStdStream:
         
     | 
| 
      
 301 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 302 
     | 
    
         
            +
             
     | 
| 
      
 303 
     | 
    
         
            +
            Style/HashAsLastArrayItem:
         
     | 
| 
      
 304 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 305 
     | 
    
         
            +
             
     | 
| 
      
 306 
     | 
    
         
            +
            Style/HashLikeCase:
         
     | 
| 
      
 307 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 308 
     | 
    
         
            +
             
     | 
| 
      
 309 
     | 
    
         
            +
            Style/OptionalBooleanParameter:
         
     | 
| 
      
 310 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 311 
     | 
    
         
            +
             
     | 
| 
      
 312 
     | 
    
         
            +
            Style/RedundantAssignment:
         
     | 
| 
      
 313 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 314 
     | 
    
         
            +
             
     | 
| 
      
 315 
     | 
    
         
            +
            Style/RedundantFetchBlock:
         
     | 
| 
      
 316 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 317 
     | 
    
         
            +
             
     | 
| 
      
 318 
     | 
    
         
            +
            Style/RedundantFileExtensionInRequire:
         
     | 
| 
      
 319 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 320 
     | 
    
         
            +
             
     | 
| 
      
 321 
     | 
    
         
            +
            Style/RedundantRegexpCharacterClass:
         
     | 
| 
      
 322 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 323 
     | 
    
         
            +
             
     | 
| 
      
 324 
     | 
    
         
            +
            Style/RedundantRegexpEscape:
         
     | 
| 
      
 325 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 326 
     | 
    
         
            +
             
     | 
| 
      
 327 
     | 
    
         
            +
            Style/SingleArgumentDig:
         
     | 
| 
      
 328 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 329 
     | 
    
         
            +
             
     | 
| 
      
 330 
     | 
    
         
            +
            Style/SlicingWithRange:
         
     | 
| 
      
 331 
     | 
    
         
            +
              Enabled: true
         
     | 
| 
      
 332 
     | 
    
         
            +
             
     | 
| 
      
 333 
     | 
    
         
            +
            Style/StringConcatenation:
         
     | 
| 
      
 334 
     | 
    
         
            +
              Enabled: true
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,3 +1,57 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ## [0.2.03] - 2020-09-02
         
     | 
| 
      
 2 
     | 
    
         
            +
            - The DSL (Domain Specific Language) supports the `caro` relation & passes frames up to 2-8 from Chapter 2.
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            ### NEW
         
     | 
| 
      
 5 
     | 
    
         
            +
            - Class `ConsCellVisitor`. Its method `df_visitor` builds a Fiber that walks over a ConsCell (list/graph).
         
     | 
| 
      
 6 
     | 
    
         
            +
            - Method `Outcome#failure?`
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Method `Outcome#prune!` for removing associations of transient variables.
         
     | 
| 
      
 8 
     | 
    
         
            +
            - Method `VariableRef#to_s` for providing a text representation of a variable reference
         
     | 
| 
      
 9 
     | 
    
         
            +
            - Method `Vocabulary#prune` for removing associations of transient variables.
         
     | 
| 
      
 10 
     | 
    
         
            +
            - Class `FreshEnvFactory` as its name implies, is used to build `FreshEnv` instances.
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            ### CHANGED
         
     | 
| 
      
 13 
     | 
    
         
            +
            - Method `Outcome#successful?` renamed to `Outcome#success?`
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            ### FIXED
         
     | 
| 
      
 16 
     | 
    
         
            +
            - Method `Equals#solver_for` now prunes associations of transient variables.
         
     | 
| 
      
 17 
     | 
    
         
            +
            - Method `Equals#unify_composite_terms` now copes with Conscell vs. VariableRef unification.
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            ## [0.2.02] - 2020-08-08
         
     | 
| 
      
 20 
     | 
    
         
            +
            - The DSL (Domain Specific Language) now supports `conde` and passes all examples from Chapter 1.
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            ### NEW
         
     | 
| 
      
 23 
     | 
    
         
            +
            - Method`Glue::DSL#conde` to implement conde goals.
         
     | 
| 
      
 24 
     | 
    
         
            +
            - Method `KBoolean#to_s` returns a text representation of a boolean value.
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            ## [0.2.01] - 2020-08-07
         
     | 
| 
      
 27 
     | 
    
         
            +
            - The DSL (Domain Specific Language) now supports `defrel` and boolean literals.
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            ### CHANGED
         
     | 
| 
      
 30 
     | 
    
         
            +
            - Constructor `DefRelation#initialize` now freezes any new class instance.  
         
     | 
| 
      
 31 
     | 
    
         
            +
            - Constructor `GoalTemplate#initialize` now freezes any new class instance.  
         
     | 
| 
      
 32 
     | 
    
         
            +
            - Mixin module `Glue::DSL` new method `defrel` to build custom relations.
         
     | 
| 
      
 33 
     | 
    
         
            +
            - File `.rubocop.yml` to please Rubocop 0.89
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
            ## [0.2.00] - 2020-07-12
         
     | 
| 
      
 36 
     | 
    
         
            +
            - First release of DSL (Domain Specific Language)
         
     | 
| 
      
 37 
     | 
    
         
            +
            - Fix defect for fused variables that remain fresh
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            ### NEW
         
     | 
| 
      
 40 
     | 
    
         
            +
            - Mix-in module `Glue::DSL` hosting methods for implementing the DSL.
         
     | 
| 
      
 41 
     | 
    
         
            +
            - Method `ConsCell#to_s` uses the Lisp convention for representing lists.
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
            ### CHANGED
         
     | 
| 
      
 44 
     | 
    
         
            +
            - File `README.md` Added a couple of examples of DSL use.
         
     | 
| 
      
 45 
     | 
    
         
            +
            - Method `AnyValue#==` can compare with symbols with format '_' + integer literal (e.g. :_0).
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            ## [0.1.13] - 2020-07-01
         
     | 
| 
      
 48 
     | 
    
         
            +
            - Cover all frames from Chapter One of "Reasoned Scheme" book.
         
     | 
| 
      
 49 
     | 
    
         
            +
            - Fix defect for fused variables that remain fresh
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            ### CHANGED
         
     | 
| 
      
 52 
     | 
    
         
            +
            - Method `Variable#quote` now takes into account of cases when variables are fused.
         
     | 
| 
      
 53 
     | 
    
         
            +
            - Method `Vocabulary#names_fused`  now copes with cases where no variable with given name can be found.
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
       1 
55 
     | 
    
         
             
            ## [0.1.12] - 2020-06-29
         
     | 
| 
       2 
56 
     | 
    
         
             
            - Supports `conde`, that is, a relation that can take an arbitrary number of arguments.
         
     | 
| 
       3 
57 
     | 
    
         
             
            - Cover all frames but one from Chapter One of "Reasoned Scheme" book.
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -4,31 +4,38 @@ 
     | 
|
| 
       4 
4 
     | 
    
         
             
            [](https://github.com/famished-tiger/mini_kraken/blob/master/LICENSE.txt)
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            ### What is __mini_kraken__ ?   
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
            A library containing an implementation of the [miniKanren](http://minikanren.org/)   
         
     | 
| 
      
 8 
     | 
    
         
            +
            relational programming language in Ruby.
         
     | 
| 
       8 
9 
     | 
    
         
             
            *miniKanren* is a small language for relational (logic) programming.  
         
     | 
| 
       9 
10 
     | 
    
         
             
            Based on the reference implementation, in Scheme from the "The Reasoned Schemer" book.   
         
     | 
| 
       10 
11 
     | 
    
         
             
            Daniel P. Friedman, William E. Byrd, Oleg Kiselyov, and Jason Hemann: "The Reasoned Schemer", Second Edition,
         
     | 
| 
       11 
12 
     | 
    
         
             
            ISBN: 9780262535519, (2018), MIT Press.
         
     | 
| 
       12 
13 
     | 
    
         | 
| 
       13 
14 
     | 
    
         
             
            ### Features
         
     | 
| 
      
 15 
     | 
    
         
            +
            - Pure Ruby implementation, not a port from another language
         
     | 
| 
      
 16 
     | 
    
         
            +
            - Object-Oriented design
         
     | 
| 
      
 17 
     | 
    
         
            +
            - No runtime dependencies
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            ### miniKanren Features
         
     | 
| 
       14 
20 
     | 
    
         
             
            - [X] ==  
         
     | 
| 
       15 
21 
     | 
    
         
             
            - [X] run\*  
         
     | 
| 
       16 
     | 
    
         
            -
            - [X] fresh 
     | 
| 
      
 22 
     | 
    
         
            +
            - [X] fresh
         
     | 
| 
      
 23 
     | 
    
         
            +
            - [X] conde
         
     | 
| 
       17 
24 
     | 
    
         
             
            - [X] conj2  
         
     | 
| 
       18 
25 
     | 
    
         
             
            - [X] disj2
         
     | 
| 
       19 
     | 
    
         
            -
            - [X] defrel 
     | 
| 
      
 26 
     | 
    
         
            +
            - [X] defrel  
         
     | 
| 
      
 27 
     | 
    
         
            +
            - [X] caro   
         
     | 
| 
       20 
28 
     | 
    
         | 
| 
       21 
29 
     | 
    
         
             
            ### TODO
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
       23 
31 
     | 
    
         
             
            - [ ] Occurs check
         
     | 
| 
       24 
32 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
            List-centric relations from Chapter 2
         
     | 
| 
       26 
     | 
    
         
            -
            - [ ]  
     | 
| 
       27 
     | 
    
         
            -
            - [ ]  
     | 
| 
       28 
     | 
    
         
            -
            - [ ]  
     | 
| 
       29 
     | 
    
         
            -
            - [ ]  
     | 
| 
       30 
     | 
    
         
            -
            - [ ]  
     | 
| 
       31 
     | 
    
         
            -
            - [ ] singletono
         
     | 
| 
      
 33 
     | 
    
         
            +
            List-centric relations from Chapter 2 
         
     | 
| 
      
 34 
     | 
    
         
            +
            - [ ] cdro  
         
     | 
| 
      
 35 
     | 
    
         
            +
            - [ ] conso  
         
     | 
| 
      
 36 
     | 
    
         
            +
            - [ ] nullo  
         
     | 
| 
      
 37 
     | 
    
         
            +
            - [ ] pairo  
         
     | 
| 
      
 38 
     | 
    
         
            +
            - [ ] singletono  
         
     | 
| 
       32 
39 
     | 
    
         | 
| 
       33 
40 
     | 
    
         
             
            ## Installation
         
     | 
| 
       34 
41 
     | 
    
         | 
| 
         @@ -46,9 +53,84 @@ Or install it yourself as: 
     | 
|
| 
       46 
53 
     | 
    
         | 
| 
       47 
54 
     | 
    
         
             
                $ gem install mini_kraken
         
     | 
| 
       48 
55 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
            ##  
     | 
| 
      
 56 
     | 
    
         
            +
            ## Examples
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            The following __MiniKraken__ examples use its DSL (Domain Specific Language).
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
            ### Example 1
         
     | 
| 
      
 61 
     | 
    
         
            +
            Let's first begin with a rather simplistic example.   
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 64 
     | 
    
         
            +
            require 'mini_kraken' # Load MiniKraken library
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
            extend(MiniKraken::Glue::DSL) # Add DSL method to self (object in context)
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
            result = run_star('q', equals(q, :pea))
         
     | 
| 
      
 69 
     | 
    
         
            +
            puts result # => (:pea)
         
     | 
| 
      
 70 
     | 
    
         
            +
            ```
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
            The two first lines in the above code snippet are pretty standard:  
         
     | 
| 
      
 73 
     | 
    
         
            +
            - The first line loads the `mini_kraken` library.
         
     | 
| 
      
 74 
     | 
    
         
            +
            - The second line add the DSL methods to the current object.
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            The next line constitutes a trivial `miniKanren` program.  
         
     | 
| 
      
 77 
     | 
    
         
            +
            The aim of a `miniKanren` program is to find one or more solutions involving the given logical variable(s)
         
     | 
| 
      
 78 
     | 
    
         
            +
            and satisfying one or more goals to the `run_star method.  
         
     | 
| 
      
 79 
     | 
    
         
            +
            In our example, the `run_star` method instructs `MiniKraken` to find all solutions,  
         
     | 
| 
      
 80 
     | 
    
         
            +
            knowing that each successful solution:
         
     | 
| 
      
 81 
     | 
    
         
            +
            - binds a value to the provided variable `q` and
         
     | 
| 
      
 82 
     | 
    
         
            +
            - meets the goal `equals(q, :pea)`.
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
            The goal `equals(q, :pea)` succeeds because the logical variable `q` is _fresh_ (that is,
         
     | 
| 
      
 85 
     | 
    
         
            +
              not yet bound to a value) and will be bound to the symbol `:pea` as a side effect
         
     | 
| 
      
 86 
     | 
    
         
            +
              of the goal `equals`.
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
            So the above program succeeds and the only found solution is obtained by binding
         
     | 
| 
      
 89 
     | 
    
         
            +
             the variable `q` to the value :pea. Hence the result of the `puts` method.
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
            ### Example 2
         
     | 
| 
      
 92 
     | 
    
         
            +
             The next example illustrates the behavior of a failing `miniKanren` program.
         
     | 
| 
      
 93 
     | 
    
         
            +
             
     | 
| 
      
 94 
     | 
    
         
            +
             ```ruby
         
     | 
| 
      
 95 
     | 
    
         
            +
             require 'mini_kraken' # Load MiniKraken library
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
             extend(MiniKraken::Glue::DSL) # Add DSL method to self (object in context)
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
             # Following miniKanren program fails
         
     | 
| 
      
 100 
     | 
    
         
            +
             result = run_star('q', [equals(q, :pea), equals(q, :pod)])
         
     | 
| 
      
 101 
     | 
    
         
            +
             puts result # => ()
         
     | 
| 
      
 102 
     | 
    
         
            +
             ```
         
     | 
| 
      
 103 
     | 
    
         
            +
            In this example, we learn that `run_star` can take multiple goals placed in an array.
         
     | 
| 
      
 104 
     | 
    
         
            +
            The program fails to find a solution since it is not possible to satisfy the two `equals` goals simultaneously.  
         
     | 
| 
      
 105 
     | 
    
         
            +
            In case of failure, the `run_star` returns an empty list represented as `()` in the output.
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
             
     | 
| 
      
 108 
     | 
    
         
            +
            ### Example 3
         
     | 
| 
      
 109 
     | 
    
         
            +
             The next example shows the use two logical variables.
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 112 
     | 
    
         
            +
            # In this example and following, one assumes that DSL is loaded as shown in Example 1
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
            result = run_star(['x', 'y'], [equals(:hello, x), equals(y, :world)])
         
     | 
| 
      
 115 
     | 
    
         
            +
            puts result # => ((:hello :world))
         
     | 
| 
      
 116 
     | 
    
         
            +
            ```
         
     | 
| 
       50 
117 
     | 
    
         | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
      
 118 
     | 
    
         
            +
            This time, `run_star` takes two logical variables -`x` and `y`- and successfully finds the solution `x = :hello, y = :world`.
         
     | 
| 
      
 119 
     | 
    
         
            +
             
     | 
| 
      
 120 
     | 
    
         
            +
            ### Example 4
         
     | 
| 
      
 121 
     | 
    
         
            +
             The next example shows the use of `disj2` goals.
         
     | 
| 
      
 122 
     | 
    
         
            +
             ```ruby
         
     | 
| 
      
 123 
     | 
    
         
            +
             result = run_star(['x', 'y'],
         
     | 
| 
      
 124 
     | 
    
         
            +
                               [
         
     | 
| 
      
 125 
     | 
    
         
            +
                                 disj2(equals(x, :blue), equals(x, :red)),
         
     | 
| 
      
 126 
     | 
    
         
            +
                                 disj2(equals(y, :sea), equals(:mountain, y))
         
     | 
| 
      
 127 
     | 
    
         
            +
                               ])
         
     | 
| 
      
 128 
     | 
    
         
            +
             puts result # => ((:blue :sea) (:blue :mountain) (:red :sea) (:red :mountain))
         
     | 
| 
      
 129 
     | 
    
         
            +
             ```
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
             Here, `run_star` takes two logical variables and two `disj2` goals.  
         
     | 
| 
      
 132 
     | 
    
         
            +
             A `disj2` succeeds if any of its arguments succeeds.  
         
     | 
| 
      
 133 
     | 
    
         
            +
             This program finds four distinct solutions for x, y pairs.
         
     | 
| 
       52 
134 
     | 
    
         | 
| 
       53 
135 
     | 
    
         
             
            ## Development
         
     | 
| 
       54 
136 
     | 
    
         |