From: "Mauricio Fernández" Date: 2003-04-07T03:02:26+09:00 Subject: Re: 2 in [1,2,3] -> true On Mon, Apr 07, 2003 at 02:46:03AM +0900, Meinrad Recheis wrote: > hi, > > i know > > [1,2,3].member? 2 -> true > is short but > > 2 in [1,2,3] -> true > would be very, very cool. i miss that most in ruby. > this syntax comes from python, as far as i am concerned. > > maybe some of you will say it isn t a good OO manner. > maybe some of you will say that it wouldn t fit ruby's expression syntax > or concept > > but i would like it so much that i had to get this lost. batsman@kodos:/tmp$ expand -t2 b.rb class Object def in(o) o.member? self end end p 2.in [1,2,3] batsman@kodos:/tmp$ ruby b.rb true The price you pay for staying with Ruby isn't even one keystroke :-) -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com Never trust an operating system you don't have sources for. ;-) -- Unknown source