Archive for December, 2007

Ruby 1.9.0 development version released

A new development version of Ruby (1.9.0) was released last week. Currently this release is not intended for production use.  There are incompatibilities with 1.8.x series and 1.9.0 is more of a stepping stone for the upcoming 2.0 release.
So what is new in Ruby 1.9.0? Here is a summary,

Block arguments are local now. This can [...]

Ruby code snippets : RPN Generator

The following program gives good illustration of string functions, regular expressions and blocks. This is a solution to the Reverse Polish Notation generator problem explained at http://www.spoj.pl/problems/ONP/.
Given an algebraic expression with brackets, this program will output the corresponding RPN form. For example, (a+(b+c)) becomes abc++. A good exercise will be to extend this program to [...]

Ruby code snippets : fibonacci series

One of the best ways to start learning Ruby is to try out simple programming problems. Let us see how we can generate fibonacci series using Ruby,

# Generates a fixed length fibonacci series
class FibonacciGenerator

# print fixed number of fibonacci series numbers specified by size
def printFibo(size)
x1,x2 [...]