module Ikra::Symbolic::ParallelOperations
Public Instance Methods
&(other)
click to toggle source
# File lib/symbolic/symbolic.rb, line 106 def &(other) return pcombine(other) do |a, b| a & b end end
*(other)
click to toggle source
# File lib/symbolic/symbolic.rb, line 88 def *(other) return pcombine(other) do |a, b| a * b end end
+(other)
click to toggle source
# File lib/symbolic/symbolic.rb, line 76 def +(other) return pcombine(other) do |a, b| a + b end end
-(other)
click to toggle source
# File lib/symbolic/symbolic.rb, line 82 def -(other) return pcombine(other) do |a, b| a - b end end
/(other)
click to toggle source
# File lib/symbolic/symbolic.rb, line 94 def /(other) return pcombine(other) do |a, b| a / b end end
<(other)
click to toggle source
# File lib/symbolic/symbolic.rb, line 118 def <(other) return pcombine(other) do |a, b| a < b end end
<=(other)
click to toggle source
# File lib/symbolic/symbolic.rb, line 124 def <=(other) return pcombine(other) do |a, b| a <= b end end
>(other)
click to toggle source
# File lib/symbolic/symbolic.rb, line 130 def >(other) return pcombine(other) do |a, b| a > b end end
>=(other)
click to toggle source
# File lib/symbolic/symbolic.rb, line 136 def >=(other) return pcombine(other) do |a, b| a >= b end end
^(other)
click to toggle source
# File lib/symbolic/symbolic.rb, line 112 def ^(other) return pcombine(other) do |a, b| a ^ b end end
pcombine(*others, **options, &block)
click to toggle source
# File lib/symbolic/symbolic.rb, line 61 def pcombine(*others, **options, &block) return ArrayCombineCommand.new( to_command, wrap_in_command(*others), block, **options) end
pmap(**options, &block)
click to toggle source
# File lib/symbolic/symbolic.rb, line 55 def pmap(**options, &block) return pcombine( **options, &block) end
preduce(symbol = nil, **options, &block)
click to toggle source
# File lib/symbolic/symbolic.rb, line 20 def preduce(symbol = nil, **options, &block) if symbol == nil && (block != nil || options[:ast] != nil) return ArrayReduceCommand.new( to_command, block, **options) elsif symbol != nil && block == nil ast = AST::BlockDefNode.new( ruby_block: nil, parameters: [:a, :b], body: AST::RootNode.new(single_child: AST::SendNode.new( receiver: AST::LVarReadNode.new(identifier: :a), selector: symbol, arguments: [AST::LVarReadNode.new(identifier: :b)]))) return ArrayReduceCommand.new( to_command, nil, ast: ast, **options) else raise ArgumentError.new("Either block or symbol expected") end end
pstencil(offsets, out_of_range_value, **options, &block)
click to toggle source
# File lib/symbolic/symbolic.rb, line 46 def pstencil(offsets, out_of_range_value, **options, &block) return ArrayStencilCommand.new( to_command, offsets, out_of_range_value, block, **options) end
pzip(*others, **options)
click to toggle source
# File lib/symbolic/symbolic.rb, line 69 def pzip(*others, **options) return ArrayZipCommand.new( to_command, wrap_in_command(*others), **options) end
|(other)
click to toggle source
# File lib/symbolic/symbolic.rb, line 100 def |(other) return pcombine(other) do |a, b| a | b end end
Private Instance Methods
wrap_in_command(*others)
click to toggle source
TODO(springerm): Should implement #== but this could cause trouble when using with hash maps etc.
# File lib/symbolic/symbolic.rb, line 147 def wrap_in_command(*others) return others.map do |other| other.to_command end end