From: Adam Prescott Date: 2011-09-04T05:16:21+09:00 Subject: Re: Beginner needing help - Writing right-angle triangle program --001517447fc88020e404ac0f2671 Content-Type: text/plain; charset=UTF-8 On Sat, Sep 3, 2011 at 4:36 PM, Gavin Kistner wrote: > def right_triangle_sides( circumference ) > [].tap do |solutions| > 1.upto(circumference-2) do |a| > 1.upto(a-1) do |b| > c = circumference-a-b > if a*a+b*b == c*c > solutions.concat( [a,b,c].permutation.to_a ) > end > end > end > end > end > A very curious use of #tap. --001517447fc88020e404ac0f2671--