Path: csiph.com!weretis.net!feeder4.news.weretis.net!storethat.news.telefonica.de!feedme.news.telefonica.de!telefonica.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: Libraries for sysadmins? Date: Sat, 5 Mar 2016 12:10:28 +0100 Lines: 28 Message-ID: References: <2cec6af2-9636-4a2a-8849-b01286c0814c@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net GGEA35u/UbEeknIvI8PFwQvwZnWqReLkR0POuOGeDM2lEIVRM= Cancel-Lock: sha1:/Hmf/FQLyc+83463YOYDMVSKGUU= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 In-Reply-To: Xref: csiph.com comp.lang.java.programmer:33929 On 04.03.2016 21:13, Stefan Ram wrote: > But it is remarkable that both languages allow to write this > at a similar level of abstraction (without loop statements) > and concepts: > > 1st) fill a linear container with numbers from 1 to 49, > 2nd) shuffle it, and then > 3rd) print the first 6, > > but both languages use different formalisms for it! Now look at the (J)Ruby solution, that does exactly what you describe above: $ irb irb(main):001:0> (1..49).to_a.shuffle[1, 6] => [27, 42, 35, 1, 37, 18] :-) Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/