On 2007-10-30 19:27:46 +0100, Konrad Meyer <konrad / tylerc.org> said:

> --nextPart1735617.YmkLPv5XtJ
> Content-Type: text/plain;
>   charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
> Content-Disposition: inline
> 
> Quoth Josselin:
>> I have a group of lines  (used in Googlemaps display)  based on 2 arrays :
>> =20
>> zl =3D 9 if farthest_proposition.distance_to(origin) < =3D 25.0
>> zl =3D 10 if farthest_proposition.distance_to(origin) <=3D 15.0
>> zl =3D 11 if farthest_proposition.distance_to(origin) <=3D 10.0
>> zl =3D 12 if farthest_proposition.distance_to(origin) <=3D 5.0
>> zl =3D 13 if farthest_proposition.distance_to(origin) < =3D2.0
>> zl =3D 14 if farthest_proposition.distance_to(origin) <=3D 1.0
>> =20
>> how could I replace it the dryest way possible ?
>> =20
>> zl =3D [9, 10, 11, 12, 13, 14]
>> distance =3D [1.0, 2.0, 5.0, 10.0, 15.0, 25.0]
>> farthest_proposition.distance_to(origin) is never > 25 (eliminated before=
> =2E.)
>> farthest_proposition.distance_to(origin)  can be 0.0, never negative
>> =20
>> thanks for yoru suggestions...
>> =20
>> joss
> 
>   zl =3D case farthest_proposition.distance_to(origin)
>     when 0..1
>       14
>     when 1..2
>       13
>     when 2..5
>       12
>     when 5..10
>       11
>     when 10..15
>       10
>     when 15..25
>       9
>   end
> 
> HTH,
> =2D-=20
> Konrad Meyer <konrad / tylerc.org> http://konrad.sobertillnoon.com/
> 
> --nextPart1735617.YmkLPv5XtJ
> Content-Type: application/pgp-signature; name=signature.asc
> Content-Description: This is a digitally signed message part.
> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (GNU/Linux)
> 
> iD8DBQBHJ3egCHB0oCiR2cwRAtyEAKC/EPouK4xAEXIOlVIhmZLoGsyehACgu2gI
> KvJhHwI/b6XDrR+iCCxh2YE=
> =Ihh1
> -----END PGP SIGNATURE-----
> 
> --nextPart1735617.YmkLPv5XtJ--

thanks a lot, I'll test it in my perf bench against other ways
joss