Method: LogicTools::Generator#each_std_conj

Defined in:
lib/logic_tools/logicgenerator.rb

#each_std_conjObject

Iterates over all the possible standard conjunctive forms.

NOTE: this iteration can be huge!


125
126
127
128
129
130
131
132
133
134
135
# File 'lib/logic_tools/logicgenerator.rb', line 125

def each_std_conj
    # No block given? Return an enumerator.
    return to_enum(:each_std_conj) unless block_given?
    
    # Block given? Apply it on each bit.
    # Iterate on each possible truth table.
    ( 2 ** (2 ** @variables.size) ).times do |table|
        # Create the expression and apply the block on it.
        yield(make_std_conj(table))
    end
end