From: botp Date: 2012-12-21T14:30:04+09:00 Subject: Re: Perl to Ruby: regex captures to assignment. --047d7bb0509ea7ee7504d1560d65 Content-Type: text/plain; charset=UTF-8 On Fri, Dec 21, 2012 at 12:59 PM, Derrick B. ....Lastly, my code I posted did not convert terms to improper fractions,... not to answer your questions, but, i'd probably go a different route ... eg, require 'rational' ["1 3/4", "-2 1/2", "5/8", "-1/3", "5", "-5"].map do |mix| mix.split.map{|x| Rational(x)} end => [ [(1/1), (3/4)], [(-2/1), (1/2)], [(5/8)], [(-1/3)], [(5/1)], [(-5/1)] ] kind regards -botp --047d7bb0509ea7ee7504d1560d65 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Fri, Dec 21, 2012 at 12:59 PM, Derrick B. <lists@ru= by-forum.com wrote:
>....Lastly, my code I posted did= not convert terms to improper fractions,...

not to answer your questions, but, i'd probab= ly go a different =C2=A0route ...=C2=A0

eg,

=
require 'rational'
["1 3/4", "-2 1/2&= quot;, "5/8", "-1/3", "5", "-5"].ma= p do |mix|
=C2=A0 mix.split.map{|x| Rational(x)} =C2=A0
end =C2=A0
=3D> [ [(1/1), (3/4)],=C2=A0 [(-2/1), (1/2)],=C2=A0 [(5/8)]= , =C2=A0[(-1/3)], =C2=A0[(5/1)], =C2=A0[(-5/1)] ]

= kind regards -botp
=C2=A0

--047d7bb0509ea7ee7504d1560d65--