Luigi Ballabio wrote:
> ...
> How about
>  >>> l = [(x,y) for x in range(1,5) for y in range(1,5) if x+y < 5]
>  >>> l
> [(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (3, 1)]
> 

irb(main):006:0> l=[]; (1..5).each{|x| (1..5).each{|y| l<<[x,y] if x+y<5}}
1..5
irb(main):007:0> l
[[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [3, 1]]
irb(main):008:0> 


Guy N. Hurst

-- 
HurstLinks Web Development    http://www.hurstlinks.com/
PHP/MySQL - Ruby/Perl - HTML/Javascript