Class: Lambda

Inherits:
Object
  • Object
show all
Defined in:
lib/lib/lambda.rb

Class Method Summary collapse

Class Method Details

.array(it) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/lib/lambda.rb', line 6

def Lambda.array(it)
  a = Array.new
  _it = Rb::RubyIterator.new(it)
  while(_it.has_next) do
    i = _it._next
    a.push(i)
  end
  a
end

.has(it, elt) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/lib/lambda.rb', line 26

def Lambda.has(it,elt)
  _it = Rb::RubyIterator.new(it)
  while(_it.has_next) do
    x = _it._next
    return true if x == elt
  end
  false
end

.map(it, f) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/lib/lambda.rb', line 16

def Lambda.map(it,f)
  l = List.new
  _it = Rb::RubyIterator.new(it)
  while(_it.has_next) do
    x = _it._next
    l.add((f).call(x))
  end
  l
end