Module: Alf::Lang::Functional

Included in:
Parser::Lispy, Optimizer::Base, Update::Inserter
Defined in:
lib/alf/lang/functional.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.def_aggregator_method(name, clazz) ⇒ Object


6
7
8
9
10
# File 'lib/alf/lang/functional.rb', line 6

def def_aggregator_method(name, clazz)
  define_method(name) do |*args, &block|
    clazz.new(*args, &block)
  end
end

.def_operator_method(name, clazz) ⇒ Object


12
13
14
15
16
17
# File 'lib/alf/lang/functional.rb', line 12

def def_operator_method(name, clazz)
  define_method(name) do |*args|
    operands, arguments = args[0...clazz.arity], args[clazz.arity..-1]
    _op_wrap clazz.new(operands.map{|op| _op_unwrap(op) }, *arguments)
  end
end

Instance Method Details

#Heading(*args, &bl) ⇒ Object


20
21
22
# File 'lib/alf/lang/functional.rb', line 20

def Heading(*args, &bl)
  Alf::Heading(*args, &bl)
end

#Relation(*args, &bl) ⇒ Object


28
29
30
# File 'lib/alf/lang/functional.rb', line 28

def Relation(*args, &bl)
  Alf::Relation(*args, &bl)
end

#Tuple(*args, &bl) ⇒ Object


24
25
26
# File 'lib/alf/lang/functional.rb', line 24

def Tuple(*args, &bl)
  Alf::Tuple(*args, &bl)
end