Currently supports:
- Insertion (insert)
- Search (search, node)
- Printing (to_s)
git clone at:
http://github.com/giancarlo/algorithms.git
Please don't interrupt. Just sit back and listen.
http://github.com/giancarlo/algorithms.git
PJF.replace("h2");
PJF.replace("#topmenu UL > LI");
PJF.replace("h1", { size: 20, color: [255, 0, 0] });
source /opt/intel/Compiler/11.0/069/bin/iccvars.sh ia32
icc -v
icc
with a configure script use ./configure CC=icc
Kernel.block_given?
will tell you if a block was passed.
def test
a = 42
yield(a) if block_given?
end
yield
or Proc.call
like this:
def test(&block)
a = 42
yield(a) # or block.call(a,b)
end
yield
calls and passes the arguments to the block.block.arity
will tell you the number of arguments a block can accept
def recursive_function(&block)
# Do stuff
recursive_function(&block)
# pass to other functions accepting blocks
10.times &block # will run block 10 times
end
def bl(&block)
yield
end
def test
bl { return }
puts "Hello" # this will not be executed.
end
break
to return a value inside a block and stop iterating.
def bl(&block)
(0..10).each &block
end
def test
# This block will stop iterating at 5 and return true.
bl { |x| (break true) if (x == 5); false }
end
<script language='javascript' src='http://www.url.com/Scripts/shCore.js'></script>
<script language='javascript'>
window.onload = function() {
dp.SyntaxHighlighter.ClipboardSwf = 'http://www.url.com/Scripts/clipboard.swf';
dp.SyntaxHighlighter.BloggerMode();
dp.SyntaxHighlighter.HighlightAll('code');
}
</script>
<link href='http://www.url.com/Styles/SyntaxHighlighter.css' rel='stylesheet' type='text/css'/>
<pre name='code' class='language'>
code;
</pre>
<script language='javascript' src='http://www.url.com/Scripts/shBrushXml.js'></script>