[#267026] attr_reader — 7stud 7stud <dolgun@...>

On p. 30-31 of "Programming Ruby (2nd ed)", there is this example:

15 messages 2007/09/01

[#267065] Seeing the source — Michel Cabili <michel.cabili@...>

Hello. I'm new to Ruby (and also to scripting languages).

38 messages 2007/09/01

[#267086] Help with leap year programing — HB <hbqian@...>

Hi, All,

19 messages 2007/09/01

[#267106] Singleton Modules rather than Singleton Classes — Trans <transfire@...>

This recently came up in the thread entitled "Python-style

14 messages 2007/09/01

[#267113] Parsing query parameters from hyperlink — "lrlebron@..." <lrlebron@...>

I am trying to parse strings like this

11 messages 2007/09/01
[#267128] Re: Parsing query parameters from hyperlink — Robert Klemme <shortcutter@...> 2007/09/01

On 01.09.2007 19:34, lrlebron@gmail.com wrote:

[#267184] How does ruby handle overloading? — pongba <pongba@...>

Matz once replied on Cedric's blog that

13 messages 2007/09/02

[#267261] subject line — "Devi Web Development" <devi.webmaster@...>

I don't know who would make this sort of decision, but could we put

103 messages 2007/09/02
[#267397] Re: subject line — Trans <transfire@...> 2007/09/03

[#267633] Re: subject line — Chad Perrin <perrin@...> 2007/09/04

On Tue, Sep 04, 2007 at 04:01:56AM +0900, Trans wrote:

[#267655] Re: subject line — Trans <transfire@...> 2007/09/04

[#267656] Re: subject line — Chad Perrin <perrin@...> 2007/09/04

On Wed, Sep 05, 2007 at 08:54:22AM +0900, Trans wrote:

[#267665] Re: subject line — "Rimantas Liubertas" <rimantas@...> 2007/09/05

> Any time you tell someone to completely change the tools (s)he uses,

[#267744] Re: subject line — Chad Perrin <perrin@...> 2007/09/05

On Wed, Sep 05, 2007 at 10:12:53AM +0900, Rimantas Liubertas wrote:

[#267266] Re: subject line — Dan Zwell <dzwell@...> 2007/09/02

Devi Web Development wrote:

[#267481] Re: subject line — Bil Kleb <Bil.Kleb@...> 2007/09/04

Chad Perrin wrote:

[#267506] Re: subject line — John Joyce <dangerwillrobinsondanger@...> 2007/09/04

Respectfully, no, unless it's very short. I suggest sort by the To:

[#267510] Re: subject line — "Robert Klemme" <shortcutter@...> 2007/09/04

I vote against, basically because I believe the issue can be solved

[#267514] Re: subject line — "Peter Cooper" <peter@...> 2007/09/04

I vote against. Those with the firehose of ruby-talk gushing into their

[#267282] assigning to hash keys when there is a default value? — 7stud -- <dolgun@...>

Can someone explain why there is a difference in the second line of

41 messages 2007/09/03
[#267283] Re: assigning to hash keys when there is a default value? — dblack@... 2007/09/03

Hi --

[#267286] Re: assigning to hash keys when there is a default value? — 7stud -- <dolgun@...> 2007/09/03

unknown wrote:

[#267310] Re: assigning to hash keys when there is a default value? — Peña, Botp <botp@...> 2007/09/03

From: 7stud -- [mailto:dolgun@excite.com]

[#267330] Re: assigning to hash keys when there is a default value? — 7stud -- <dolgun@...> 2007/09/03

Pe単a, Botp wrote:

[#267335] Re: assigning to hash keys when there is a default value? — "Russell Norris" <rsl@...> 2007/09/03

I don't think this is a bug, kittens. since h[2] returns a value [eventhough it's not set], it causes h[2] to evaluate so the assignmentnever happens. x ||= y just means give me x or set x to y if there'sno value for x. h[2] _does_ have a value if only a default one.

[#267338] Re: assigning to hash keys when there is a default value? — dblack@... 2007/09/03

Hi --

[#267344] Re: assigning to hash keys when there is a default value? — "Russell Norris" <rsl@...> 2007/09/03

I learned that x ||= y means set x to y unless x, so I don't see the

[#267431] Re: assigning to hash keys when there is a default value? — Peña, Botp <botp@...> 2007/09/04

From: sconds@gmail.com [mailto:sconds@gmail.com] On Behalf Of Russell Norris:

[#267511] Re: assigning to hash keys when there is a default value? — "Robert Klemme" <shortcutter@...> 2007/09/04

2007/9/4, Pe, Botp <botp@delmonte-phil.com>:

[#267325] Re: assigning to hash keys when there is a default value? — "Robert Klemme" <shortcutter@...> 2007/09/03

2007/9/3, dblack@wobblini.net <dblack@wobblini.net>:

[#267318] Filling individual cells in a grid — Joop Van den tillaart <tillaart36@...>

Hi guys,

32 messages 2007/09/03
[#267326] Re: Filling individual cells in a grid — "Todd Benson" <caduceass@...> 2007/09/03

On 9/3/07, Joop Van den tillaart <tillaart36@hotmail.com> wrote:

[#267329] Re: Filling individual cells in a grid — Joop Van den tillaart <tillaart36@...> 2007/09/03

> With your current code...

[#267341] Re: Filling individual cells in a grid — Joop Van den tillaart <tillaart36@...> 2007/09/03

Is there no one else who can help me out a bit?

[#267348] Re: Filling individual cells in a grid — Morton Goldberg <m_goldberg@...> 2007/09/03

On Sep 3, 2007, at 8:40 AM, Joop Van den tillaart wrote:

[#267363] Re: Filling individual cells in a grid — Joop Van den tillaart <tillaart36@...> 2007/09/03

Wow, thanks for your help...

[#267868] Re: Filling individual cells in a grid — Joop Van den tillaart <tillaart36@...> 2007/09/06

Joop Van den tillaart wrote:

[#267885] Re: Filling individual cells in a grid — Morton Goldberg <m_goldberg@...> 2007/09/06

On Sep 6, 2007, at 7:44 AM, Joop Van den tillaart wrote:

[#267899] Re: Filling individual cells in a grid — Joop Van den tillaart <tillaart36@...> 2007/09/06

hi thanks for your help,

[#267964] Re: Filling individual cells in a grid — Morton Goldberg <m_goldberg@...> 2007/09/06

On Sep 6, 2007, at 11:38 AM, Joop Van den tillaart wrote:

[#267984] Re: Filling individual cells in a grid — Morton Goldberg <m_goldberg@...> 2007/09/06

On Sep 6, 2007, at 4:47 PM, Morton Goldberg wrote:

[#268074] Re: Filling individual cells in a grid — Joop Van den tillaart <tillaart36@...> 2007/09/07

Morton Goldberg wrote:

[#268630] Re: Filling individual cells in a grid — Joop Van den tillaart <tillaart36@...> 2007/09/11

Hi guys,

[#268645] Re: Filling individual cells in a grid — Morton Goldberg <m_goldberg@...> 2007/09/11

[#268647] Re: Filling individual cells in a grid — Joop Van den tillaart <tillaart36@...> 2007/09/11

Morton Goldberg wrote:

[#268677] Re: Filling individual cells in a grid — Morton Goldberg <m_goldberg@...> 2007/09/11

On Sep 11, 2007, at 7:57 AM, Joop Van den tillaart wrote:

[#268695] Re: Filling individual cells in a grid — Morton Goldberg <m_goldberg@...> 2007/09/11

On Sep 11, 2007, at 2:03 PM, Morton Goldberg wrote:

[#268705] Re: Filling individual cells in a grid — Morton Goldberg <m_goldberg@...> 2007/09/11

On Sep 11, 2007, at 4:34 PM, Morton Goldberg wrote:

[#267357] with — Matthias Wächter <matthias@...>

Sorry folks if this was raised already, but google is not very

14 messages 2007/09/03

[#267370] wierd floating point output — Matthias Wächter <matthias@...>

Folks,

14 messages 2007/09/03
[#267371] Re: wierd floating point output — dblack@... 2007/09/03

Hi --

[#267373] Re: wierd floating point output — Matthias Wächter <matthias@...> 2007/09/03

On 03.09.2007 19:51, dblack@wobblini.net wrote:

[#267433] Programming Ruby For Newbies — Jin Dynasty <jin.the.miner@...>

Howdy there,

25 messages 2007/09/04

[#267457] Ruby is much slower on linux when compiled with --enable-pthread? — "Adam Kramer" <akramer@...>

Hi,

18 messages 2007/09/04

[#267469] Best IDE for ruby and rails development — AJay Maurya <amaurya@...>

36 messages 2007/09/04
[#267471] Re: Best IDE for ruby and rails development — "Thomas Preymesser" <thopre@...> 2007/09/04

On 04/09/07, AJay Maurya <amaurya@brickred.com> wrote:

[#267476] Re: Best IDE for ruby and rails development — Arthur Murauskas <arthur.murauskas@...> 2007/09/04

On Tuesday 04 September 2007 10:31:23 AJay Maurya wrote:

[#267569] running ruby — yahdoco <yahdoco@...>

Hi Everyone...I am a very new ruby user. I have downloaded ruby to my

28 messages 2007/09/04
[#267574] Re: running ruby — Konrad Meyer <konrad@...> 2007/09/04

On Tuesday 04 September 2007 11:20:05 am yahdoco wrote:

[#267594] Re: running ruby — yahdoco <yahdoco@...> 2007/09/04

I sill have the same two problems:

[#267573] Embedded vs. Non-embedded Tests — Trans <transfire@...>

As far as I know, Facets is the only large project that uses embedded

14 messages 2007/09/04
[#267579] Re: Embedded vs. Non-embedded Tests — "Rick DeNatale" <rick.denatale@...> 2007/09/04

On 9/4/07, Trans <transfire@gmail.com> wrote:

[#267723] Multiple Assignments: Newbie question — "Z T" <zoater@...>

When I run my program:

15 messages 2007/09/05

[#267783] before, after and around Ruby 1.9 — Trans <transfire@...>

Any chance Ruby 1.9 will have before, after and around method

40 messages 2007/09/05
[#267816] Re: before, after and around Ruby 1.9 — Yukihiro Matsumoto <matz@...> 2007/09/05

Hi,

[#267825] Re: before, after and around Ruby 1.9 — Joel VanderWerf <vjoel@...> 2007/09/06

Yukihiro Matsumoto wrote:

[#267797] question on bottleneck of ruby — Roger Pack <rogerpack2005@...>

Question: if I made the statement "Ruby is slower than some other

26 messages 2007/09/05
[#267807] Re: question on bottleneck of ruby — khaines@... 2007/09/05

On Thu, 6 Sep 2007, Roger Pack wrote:

[#271288] Re: question on bottleneck of ruby — Roger Pack <rogerpack2005@...> 2007/09/27

Thanks Kirk.

[#271298] Re: question on bottleneck of ruby — "Francis Cianfrocca" <garbagecat10@...> 2007/09/27

On 9/27/07, Roger Pack <rogerpack2005@gmail.com> wrote:

[#267857] Symbols and frozen strings — Brian Candler <B.Candler@...>

I just had a thought.

13 messages 2007/09/06

[#267871] Count and Say (#138) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

21 messages 2007/09/06

[#267941] Is this a bug or a feature? — Martin Jansson <martialis@...>

irb(main):002:0> i=1

13 messages 2007/09/06

[#268006] help me condence my code? — "Simon Schuster" <significants@...>

I know this could be more idiomatic to ruby.

23 messages 2007/09/07

[#268052] read a specific line from a file — Bulhac Mihai <mihai.bulhac@...>

how can i read only a line from a txt file?

18 messages 2007/09/07

[#268108] Netbeans, Eclipse and ruby! How to...? — "André Cardoso" <thyandrecardoso@...>

well, i should start to say that i'm pretty new to ruby!!

15 messages 2007/09/07

[#268307] Bug in lambda? — kevin cline <kevin.cline@...>

This looks like a pretty serious bug. It seems that lambda-

36 messages 2007/09/09
[#268323] Re: Bug in lambda? — dblack@... 2007/09/09

Hi --

[#268485] Re: Bug in lambda? — "Robert Klemme" <shortcutter@...> 2007/09/10

2007/9/9, dblack@wobblini.net <dblack@wobblini.net>:

[#268316] module_function :func vs. MyModule.func? — 7stud -- <dolgun@...>

The following produce the same output:

16 messages 2007/09/09

[#268362] Hash — Ron Green <rongreen1@...>

What is the purpose of string hash? What would you use it for?

21 messages 2007/09/09

[#268403] What Linux distribution to choose for learning Ruby and Ruby on Rails — "Slavo Furman" <slavof@...>

Hi!

82 messages 2007/09/09
[#268413] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — "M. Edward (Ed) Borasky" <znmeb@...> 2007/09/09

-----BEGIN PGP SIGNED MESSAGE-----

[#268418] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — "Slavo Furman" <slavof@...> 2007/09/09

Thanks for all answers... :)

[#268425] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — "M. Edward (Ed) Borasky" <znmeb@...> 2007/09/10

-----BEGIN PGP SIGNED MESSAGE-----

[#268427] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — Reid Thompson <reid.thompson@...> 2007/09/10

M. Edward (Ed) Borasky wrote:

[#268439] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — "M. Edward (Ed) Borasky" <znmeb@...> 2007/09/10

-----BEGIN PGP SIGNED MESSAGE-----

[#268444] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — Reid Thompson <reid.thompson@...> 2007/09/10

M. Edward (Ed) Borasky wrote:

[#268451] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — "M. Edward (Ed) Borasky" <znmeb@...> 2007/09/10

-----BEGIN PGP SIGNED MESSAGE-----

[#268545] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — Ezra Zygmuntowicz <ezmobius@...> 2007/09/10

Hi~

[#268595] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — "M. Edward (Ed) Borasky" <znmeb@...> 2007/09/11

-----BEGIN PGP SIGNED MESSAGE-----

[#268606] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — Chad Perrin <perrin@...> 2007/09/11

On Tue, Sep 11, 2007 at 12:00:57PM +0900, M. Edward (Ed) Borasky wrote:

[#268611] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — "M. Edward (Ed) Borasky" <znmeb@...> 2007/09/11

-----BEGIN PGP SIGNED MESSAGE-----

[#268614] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — bob@... (Bob Proulx) 2007/09/11

M. Edward (Ed) Borasky wrote:

[#268405] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — Marcin Raczkowski <mailing.mr@...> 2007/09/09

Slavo Furman wrote:

[#268750] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — hemant <gethemant@...> 2007/09/12

On 9/10/07, Marcin Raczkowski <mailing.mr@gmail.com> wrote:

[#269173] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — "Shot (Piotr Szotkowski)" <shot@...> 2007/09/15

hemant:

[#269182] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — "Todd Benson" <caduceass@...> 2007/09/15

On 9/15/07, Shot (Piotr Szotkowski) <shot@hot.pl> wrote:

[#269199] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — "M. Edward (Ed) Borasky" <znmeb@...> 2007/09/15

Todd Benson wrote:

[#268433] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — Trans <transfire@...> 2007/09/10

[#268436] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — "M. Edward (Ed) Borasky" <znmeb@...> 2007/09/10

-----BEGIN PGP SIGNED MESSAGE-----

[#268447] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — Trans <transfire@...> 2007/09/10

[#268513] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — Chad Perrin <perrin@...> 2007/09/10

On Mon, Sep 10, 2007 at 12:07:42PM +0900, Trans wrote:

[#268517] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — Lionel Bouton <lionel-subscription@...> 2007/09/10

Chad Perrin wrote the following on 10.09.2007 18:46 :

[#268539] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — Chad Perrin <perrin@...> 2007/09/10

On Tue, Sep 11, 2007 at 01:54:42AM +0900, Lionel Bouton wrote:

[#268557] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — Lionel Bouton <lionel-subscription@...> 2007/09/10

Thanks for the answer, that was an interesting reading. I've some

[#268565] Re: [OT] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — Chad Perrin <perrin@...> 2007/09/10

On Tue, Sep 11, 2007 at 05:38:32AM +0900, Lionel Bouton wrote:

[#268570] Re: [OT] Re: What Linux distribution to choose for learning Ruby and Ruby on Rails — Chad Perrin <perrin@...> 2007/09/10

On Tue, Sep 11, 2007 at 07:00:50AM +0900, Chad Perrin wrote:

[#268658] undefined method `+' for nil:NilClass (NoMeth — Mahen Surinam <neoanderson12@...>

Dear All,

14 messages 2007/09/11

[#268663] Camping or Merb — "Eduardo Tongson" <propolice@...>

Hi folks,

19 messages 2007/09/11

[#268672] Graphics... why so shrouded in mystery? — Weston Campbell <silvershockwave@...>

I've been working with ruby for quite a while now, and I still don't

13 messages 2007/09/11

[#268761] what is this syntax: \001\002 ? — 7stud -- <dolgun@...>

Hi,

15 messages 2007/09/12

[#268786] copy/paste line numbers with code — Max Williams <toastkid.williams@...>

I'm writing up my project report and want to include line numbers with

12 messages 2007/09/12

[#268802] IronRuby — Lloyd Linklater <lloyd@2live4.com>

I have heard disturbing things about IronRuby. The short version is

36 messages 2007/09/12
[#268828] Re: IronRuby — Greg Donald <greg@...> 2007/09/12

On Thu, 13 Sep 2007, Lloyd Linklater wrote:

[#268833] Re: IronRuby — "Felix Windt" <fwmailinglists@...> 2007/09/12

> -----Original Message-----

[#268911] Re: IronRuby — Charles Oliver Nutter <charles.nutter@...> 2007/09/13

Bill Kelly wrote:

[#268918] Debug — "coolgeng coolgeng" <coolgeng410@...>

With the Rails, I build a project connecting the MySQL. But When I change

17 messages 2007/09/13

[#268970] Cross-platform Home Directory? — Trans <transfire@...>

I have a little app that needs to store session data. I assume the

19 messages 2007/09/13

[#269047] IP to Country (#139) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

32 messages 2007/09/14

[#269063] How many computers in the house? — Todd Burch <promos@...>

I went to the Lone Star Ruby Conference last week. 7 of us went out to

41 messages 2007/09/14

[#269125] Unicode — Zephyr Pellerin <ztz@...>

I hate to discuss something related to the development timeline, I know

26 messages 2007/09/15
[#270180] Re: Unicode — "Michal Suchanek" <hramrach@...> 2007/09/21

On 15/09/2007, Zephyr Pellerin <ztz@nxvr.org> wrote:

[#269140] one line to print the statement AS WELL AS the evaluated value like in C — kendear <summercoolness@...>

i wonder in Ruby, is there a line method to do something like in C

11 messages 2007/09/15

[#269214] Newbie help — Ali Koubeissi <ali.koubeissi@...>

Hey, I've started with Ruby two days ago, and I have some questions.

19 messages 2007/09/16

[#269251] Ruby Forum > Ruby Talk > comp.lang.ruby ? — Kenneth LL <kenneth.kin.lum@...>

so it seems like Google created Ruby Talk and anything posted to Ruby

25 messages 2007/09/16

[#269315] Newbie: what's Ruby idiom for word-by-word input? — Alex Shulgin <alex.shulgin@...>

Hi,

16 messages 2007/09/16
[#269326] Re: Newbie: what's Ruby idiom for word-by-word input? — Robert Klemme <shortcutter@...> 2007/09/16

On 16.09.2007 21:08, Alex Shulgin wrote:

[#269407] Re: Newbie: what's Ruby idiom for word-by-word input? — Alex Shulgin <alex.shulgin@...> 2007/09/17

On Sep 17, 12:19 am, Robert Klemme <shortcut...@googlemail.com> wrote:

[#269441] Re: Newbie: what's Ruby idiom for word-by-word input? — William James <w_a_x_man@...> 2007/09/17

On Sep 17, 4:30 am, Alex Shulgin <alex.shul...@gmail.com> wrote:

[#269357] Tk Ruby / Fx Ruby / Wx Ruby — "Jayson Williams" <williams.jayson@...>

I have looked at these three GUI's for Ruby, and would like to know

12 messages 2007/09/17

[#269440] group array elements in groups of two — Emmanuel Oga <oga_emmanuel_oga@...>

A better way to do this? :

13 messages 2007/09/17

[#269450] how to use tuple as hash key — SpringFlowers AutumnMoon <summercoolness@...>

in Python, a hash key cannot be [1,2,3] but must be (1,2,3), a tuple.

13 messages 2007/09/17
[#269453] Re: how to use tuple as hash key — Stefano Crocco <stefano.crocco@...> 2007/09/17

Alle luned狸 17 settembre 2007, SpringFlowers AutumnMoon ha scritto:

[#269562] The meaning of a = b in object oriented languages — Summercool <Summercoolness@...>

30 messages 2007/09/18

[#269596] finding string matches, in order, in a file — Peter Bailey <pbailey@...>

Hi,

19 messages 2007/09/18
[#269601] Re: finding string matches, in order, in a file — William James <w_a_x_man@...> 2007/09/18

[#269605] Re: finding string matches, in order, in a file — Peter Bailey <pbailey@...> 2007/09/18

William James wrote:

[#269627] Re: finding string matches, in order, in a file — William James <w_a_x_man@...> 2007/09/18

On Sep 18, 8:28 am, Peter Bailey <pbai...@bna.com> wrote:

[#269631] Re: finding string matches, in order, in a file — Peter Bailey <pbailey@...> 2007/09/18

William James wrote:

[#269637] Re: finding string matches, in order, in a file — William James <w_a_x_man@...> 2007/09/18

On Sep 18, 10:27 am, Peter Bailey <pbai...@bna.com> wrote:

[#269616] CPU Usage not near 100% when running code — SpringFlowers AutumnMoon <summercoolness@...>

I tested some computation intensive Ruby code. When running, the CPU

11 messages 2007/09/18

[#269732] How to print FULL stacktrace of exception w/ line #? — Andrew Chen <meihome@...>

The ruby interpreter prints out a full trace of the exception.

12 messages 2007/09/19

[#269779] how can I remove all the comments in my c program. — Vellingiri Arul <hariharan.spc@...>

Dear Friends,

25 messages 2007/09/19

[#269813] YAML & readlines & modify text files — Dan George <endege@...>

Hello,

16 messages 2007/09/19
[#269834] Re: YAML & readlines & modify text files — Stefano Crocco <stefano.crocco@...> 2007/09/19

Alle mercoled19 settembre 2007, Dan George ha scritto:

[#269879] Re: YAML & readlines & modify text files — Dan George <endege@...> 2007/09/19

On Sep 19, 5:27 pm, Stefano Crocco <stefano.cro...@alice.it> wrote:

[#269888] Re: YAML & readlines & modify text files — Stefano Crocco <stefano.crocco@...> 2007/09/19

Alle mercoled19 settembre 2007, Dan George ha scritto:

[#269910] Re: YAML & readlines & modify text files — Dan George <endege@...> 2007/09/19

On Sep 19, 9:22 pm, Stefano Crocco <stefano.cro...@alice.it> wrote:

[#269913] Re: YAML & readlines & modify text files — Stefano Crocco <stefano.crocco@...> 2007/09/19

Alle mercoled19 settembre 2007, Dan George ha scritto:

[#269925] Re: YAML & readlines & modify text files — Dan George <endege@...> 2007/09/19

On Sep 19, 11:03 pm, Stefano Crocco <stefano.cro...@alice.it> wrote:

[#269816] How to compute Sunrise / Sunset ? — Joe Joe <joepetrini@...>

I need to compute sunrise/set times in ruby for a given long lat. Does

12 messages 2007/09/19

[#269862] special Array method about Unix pathes — unbewusst.sein@... (Une B騅ue)

15 messages 2007/09/19

[#269873] scraping web pages for cisco products — Chuck Dawit <chuckdawit@...>

16 messages 2007/09/19

[#269902] Do C Extensions Block Ruby? — "Wayne E. Seguin" <wayneeseguin@...>

Does a C extension running in a ruby-thread block all ruby threads

16 messages 2007/09/19
[#269904] Re: Do C Extensions Block Ruby? — Nobuyoshi Nakada <nobu@...> 2007/09/19

Hi,

[#269924] Re: Do C Extensions Block Ruby? — Joel VanderWerf <vjoel@...> 2007/09/19

Nobuyoshi Nakada wrote:

[#269971] Is there any separate editor for ruby? — Vellingiri Arul <hariharan.spc@...>

Hai Friends,

13 messages 2007/09/20

[#270018] Idiomatic Ruby for Array#extract / Range#length? — "Sammy Larbi" <sam@...>

During the monthly meeting of our code dojo, we were surprised by a couple

27 messages 2007/09/20
[#270039] Re: Idiomatic Ruby for Array#extract / Range#length? — Xavier Noria <fxn@...> 2007/09/20

On Sep 20, 2007, at 2:28 PM, Sammy Larbi wrote:

[#270047] Re: Idiomatic Ruby for Array#extract / Range#length? — "Rick DeNatale" <rick.denatale@...> 2007/09/20

On 9/20/07, Xavier Noria <fxn@hashref.com> wrote:

[#270051] Re: Idiomatic Ruby for Array#extract / Range#length? — Xavier Noria <fxn@...> 2007/09/20

On Sep 20, 2007, at 5:39 PM, Rick DeNatale wrote:

[#270056] Re: Idiomatic Ruby for Array#extract / Range#length? — "Rick DeNatale" <rick.denatale@...> 2007/09/20

On 9/20/07, Xavier Noria <fxn@hashref.com> wrote:

[#270065] Re: Idiomatic Ruby for Array#extract / Range#length? — "Rick DeNatale" <rick.denatale@...> 2007/09/20

On 9/20/07, Rick DeNatale <rick.denatale@gmail.com> wrote:

[#270084] Re: Idiomatic Ruby for Array#extract / Range#length? — Xavier Noria <fxn@...> 2007/09/20

On Sep 20, 2007, at 7:26 PM, Rick DeNatale wrote:

[#270110] I am new to Ruby and I could use some expert advice as to how I can make this code run faster. — Ruby Maniac <raychorn@...>

I am new to Ruby and I could use some expert advice as to how I can

62 messages 2007/09/20
[#270145] Re: I am new to Ruby and I could use some expert advice as to how I can make this code run faster. — Brian Adkins <lojicdotcom@...> 2007/09/21

On Sep 20, 6:02 pm, Ruby Maniac <raych...@hotmail.com> wrote:

[#270149] Re: I am new to Ruby and I could use some expert advice as to how I can make this code run faster. — John Joyce <dangerwillrobinsondanger@...> 2007/09/21

[#270236] Re: I am new to Ruby and I could use some expert advice as to how I can make this code run faster. — Ruby Maniac <raychorn@...> 2007/09/21

On Sep 20, 7:16 pm, John Joyce <dangerwillrobinsondan...@gmail.com>

[#270239] Re: I am new to Ruby and I could use some expert advice as to how I can make this code run faster. — "Todd Benson" <caduceass@...> 2007/09/21

On 9/21/07, Ruby Maniac <raychorn@hotmail.com> wrote:

[#270305] Re: I am new to Ruby and I could use some expert advice as to how I can make this code run faster. — "Nobuyoshi Nakada" <nobu@...> 2007/09/22

Hi,

[#270575] Re: I am new to Ruby and I could use some expert advice as to how I can make this code run faster. — "Ilmari Heikkinen" <ilmari.heikkinen@...> 2007/09/24

On 9/22/07, Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:

[#270115] How fast does your Ruby run? — SpringFlowers AutumnMoon <summercoolness@...>

How fast does your Ruby run?

114 messages 2007/09/20
[#270118] Re: How fast does your Ruby run? — Todd Burch <promos@...> 2007/09/20

SpringFlowers AutumnMoon wrote:

[#270167] Re: How fast does your Ruby run? — Charles Oliver Nutter <charles.nutter@...> 2007/09/21

Todd Burch wrote:

[#270168] Re: How fast does your Ruby run? — Charles Oliver Nutter <charles.nutter@...> 2007/09/21

Charles Oliver Nutter wrote:

[#270182] Re: How fast does your Ruby run? — gga <GGarramuno@...> 2007/09/21

Seems like a pretty silly test, but okay...

[#270468] Re: How fast does your Ruby run? — David Orriss Jr <codethought@...> 2007/09/23

SpringFlowers AutumnMoon wrote:

[#276142] Re: How fast does your Ruby run? — Daniel Schömer <daniel.schoemer@...> 2007/10/27

Gentoo Linux on Intel Pentium 4 2.40GHz (512 KB cache):

[#276152] Re: How fast does your Ruby run? — Charles Oliver Nutter <charles.nutter@...> 2007/10/27

Daniel Scher wrote:

[#276153] Re: How fast does your Ruby run? — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/27

Charles Oliver Nutter wrote:

[#276191] Re: How fast does your Ruby run? — Charles Oliver Nutter <charles.nutter@...> 2007/10/27

M. Edward (Ed) Borasky wrote:

[#270161] Re: [ANN] Metadata 1.0-rc2 — Peña, Botp <botp@...>

From: Ilmari Heikkinen [mailto:ilmari.heikkinen@gmail.com]

6 messages 2007/09/21

[#270245] CplusRuby - Gluing C and Ruby — Michael Neumann <mneumann@...>

Hi all,

22 messages 2007/09/21

[#270320] sequel problem: no such file to load -- mysql (LoadError) — Michael Andreasen <ventosus@...>

Hi, i tried to learn about sequel (and Ruby) and got this problem

10 messages 2007/09/22

[#270377] Getting started with Ruby (noob confusion) — Nunya Business <sasnso4a5w12kb8@...>

Hi everyone!

16 messages 2007/09/22

[#270451] Recent Criticism about Ruby (Scalability, etc.) — "forrie@..." <forrie@...>

I presume most people here read today's article on Slashdot which had

80 messages 2007/09/23
[#270729] Re: Recent Criticism about Ruby (Scalability, etc.) — "Phlip" <phlip2005@...> 2007/09/25

> I presume most people here read today's article on Slashdot

[#270760] Re: Recent Criticism about Ruby (Scalability, etc.) — Chad Perrin <perrin@...> 2007/09/25

On Tue, Sep 25, 2007 at 01:04:21PM +0900, Phlip wrote:

[#270789] Re: Recent Criticism about Ruby (Scalability, etc.) — Ruby Maniac <rubymaniac@...> 2007/09/25

On Sep 25, 1:15 am, Chad Perrin <per...@apotheon.com> wrote:

[#271162] Re: Recent Criticism about Ruby (Scalability, etc.) — Chad Perrin <perrin@...> 2007/09/26

On Tue, Sep 25, 2007 at 10:40:04PM +0900, Ruby Maniac wrote:

[#272380] Re: Recent Criticism about Ruby (Scalability, etc.) — Charles Oliver Nutter <charles.nutter@...> 2007/10/03

Chad Perrin wrote:

[#272394] Re: Recent Criticism about Ruby (Scalability, etc.) — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/03

Charles Oliver Nutter wrote:

[#272398] Re: Recent Criticism about Ruby (Scalability, etc.) — benjohn@... 2007/10/03

[#272405] Re: Recent Criticism about Ruby (Scalability, etc.) — MenTaLguY <mental@...> 2007/10/03

On Thu, 4 Oct 2007 00:19:40 +0900, benjohn@fysh.org wrote:

[#272412] Re: Recent Criticism about Ruby (Scalability, etc.) — Chad Perrin <perrin@...> 2007/10/03

On Thu, Oct 04, 2007 at 12:38:25AM +0900, MenTaLguY wrote:

[#272426] Re: Recent Criticism about Ruby (Scalability, etc.) — MenTaLguY <mental@...> 2007/10/03

On Thu, 4 Oct 2007 01:42:22 +0900, Chad Perrin <perrin@apotheon.com> wrote:

[#272439] Re: Recent Criticism about Ruby (Scalability, etc.) — Chad Perrin <perrin@...> 2007/10/03

On Thu, Oct 04, 2007 at 02:39:28AM +0900, MenTaLguY wrote:

[#270924] Re: Recent Criticism about Ruby (Scalability, etc.) — "M. Edward (Ed) Borasky" <znmeb@...> 2007/09/26

Chad Perrin wrote:

[#270482] how to use Ruby / Tk to display a text message status box — SpringFlowers AutumnMoon <summercoolness@...>

how can we pop up a Tk window to display the temporary results of a

17 messages 2007/09/23
[#270980] Re: how to use Ruby / Tk to display a text message status box — Summercool <Summercoolness@...> 2007/09/26

[#270508] This is why Ruby 1.8.6 can never be made to run anywhere near as fast as Python 2.5.1 — Ruby Maniac <raychorn@...>

I welcome any corrections anyone might be able to make since I am new

60 messages 2007/09/24
[#270524] Re: This is why Ruby 1.8.6 can never be made to run anywhere near as fast as Python 2.5.1 — Phrogz <phrogz@...> 2007/09/24

On Sep 23, 8:50 pm, Ruby Maniac <raych...@hotmail.com> wrote:

[#270531] Re: This is why Ruby 1.8.6 can never be made to run anywhere near as fast as Python 2.5.1 — John Joyce <dangerwillrobinsondanger@...> 2007/09/24

Why do people troll?

[#270535] Re: This is why Ruby 1.8.6 can never be made to run anywhere near as fast as Python 2.5.1 — Mohit Sindhwani <mo_mail@...> 2007/09/24

John Joyce wrote:

[#270557] Re: This is why Ruby 1.8.6 can never be made to run anywhere near as fast as Python 2.5.1 — benjohn@... 2007/09/24

> John Joyce wrote:

[#270597] Re: This is why Ruby 1.8.6 can never be made to run anywhere near as fast as Python 2.5.1 — Chad Perrin <perrin@...> 2007/09/24

On Mon, Sep 24, 2007 at 06:34:57PM +0900, benjohn@fysh.org wrote:

[#270599] Re: This is why Ruby 1.8.6 can never be made to run anywhere near as fast as Python 2.5.1 — "M. Edward (Ed) Borasky" <znmeb@...> 2007/09/24

Chad Perrin wrote:

[#270727] Re: This is why Ruby 1.8.6 can never be made to run anywhere — 7stud -- <dolgun@...> 2007/09/25

Bill Kelly wrote:

[#270532] Re: This is why Ruby 1.8.6 can never be made to run anywhere near as fast as Python 2.5.1 — "Michael T. Richter" <ttmrichter@...> 2007/09/24

Can I ask why *ANYBODY* took a message by someone calling themselves

[#270536] Re: This is why Ruby 1.8.6 can never be made to run anywhere near as fast as Python 2.5.1 — "M. Edward (Ed) Borasky" <znmeb@...> 2007/09/24

Michael T. Richter wrote:

[#270542] "myscript.rb " - there's a blank in my name! — Todd Burch <promos@...>

On a Mac - Tiger 10.4.10.

13 messages 2007/09/24

[#270596] best way to 'hide' a method when method_missing is in town — "Kevin Barnes" <vinbarnes@...>

I am trying to hide a method in a subclass whose base class has

11 messages 2007/09/24

[#270663] Favorite idiom for "keep doing this until it returns nil/false" — Phrogz <phrogz@...>

I want to keep running gsub! on a string until it returns nil. How do

12 messages 2007/09/24

[#270708] object_id 1, 2, 3 — SpringFlowers AutumnMoon <summercoolness@...>

Fixnum object_id

15 messages 2007/09/25

[#270788] I love Ruby but what is the deal with... this ! — Ruby Maniac <rubymaniac@...>

I love Ruby but what is the deal with the lack of a VM ?

25 messages 2007/09/25
[#270791] Re: I love Ruby but what is the deal with... this ! — Gregory Seidman <gsslist+ruby@...> 2007/09/25

On Tue, Sep 25, 2007 at 10:35:06PM +0900, Ruby Maniac wrote:

[#270794] Re: I love Ruby but what is the deal with... this ! — Ruby Maniac <rubymaniac@...> 2007/09/25

On Sep 25, 6:52 am, Gregory Seidman <gsslist+r...@anthropohedron.net>

[#270815] Re: I love Ruby but what is the deal with... this ! — "Walter Purvis" <wpmailinglists@...> 2007/09/25

Troll.

[#270867] Re: I love Ruby but what is the deal with... this ! — Ruby Maniac <rubymaniac@...> 2007/09/25

On Sep 25, 8:23 am, "Walter Purvis" <wpmailingli...@gmail.com> wrote:

[#270872] Re: I love Ruby but what is the deal with... this ! — Phlip <phlip2005@...> 2007/09/25

> Do you classify all those who have an opposing viewpoint as being a

[#270792] Ruby Scales just fine ! — Ruby Maniac <rubymaniac@...>

Just buy a bunch of Quad Core Opterons and get over it !

24 messages 2007/09/25
[#270800] Re: Ruby Scales just fine ! — "M. Edward (Ed) Borasky" <znmeb@...> 2007/09/25

Ruby Maniac wrote:

[#270842] Re: Ruby Scales just fine ! — Eric Hodel <drbrain@...7.net> 2007/09/25

On Sep 25, 2007, at 07:22 , M. Edward (Ed) Borasky wrote:

[#270813] Why dynamic languages for ActiveRecord..? — ypomonh <ypomonh@...>

I having problems understanding why people prefer to implement the

14 messages 2007/09/25

[#270888] The guy who wrote RubyScript2Exe needs to seriously reconsider how this little "gem" works... — Ruby Maniac <rubymaniac@...>

I have a very simple Ruby script that does nothing more than compute

13 messages 2007/09/25

[#270916] ruby regex on html file — eggie5 <eggie5@...>

I'm trying to write a rake task to extract all the script tags out of

12 messages 2007/09/25

[#270966] Feature request for RubyScript2Exe — Ruby Maniac <rubymaniac@...>

It would be nice if RubyScript2Exe was able to handle a passworded ZIP

11 messages 2007/09/26

[#270989] Detecting number ranges — Jay Levitt <jay+news@...>

I had to write a script this evening to take an unsorted input file of the

17 messages 2007/09/26

[#271046] Finding the last Sunday of a month — Peter Bailey <pbailey@...>

Hello,

31 messages 2007/09/26
[#271050] Re: Finding the last Sunday of a month — Yossef Mendelssohn <ymendel@...> 2007/09/26

On Sep 26, 8:44 am, Peter Bailey <pbai...@bna.com> wrote:

[#271078] Recursing through directories — Gabriel Dragffy <gabe@...>

Hi there

14 messages 2007/09/26

[#271089] OneClickInstaller/RubyGems problems — Trans <transfire@...>

Is there anything you have to do after installing the Windows

16 messages 2007/09/26

[#271143] Confession: I never learned CS — Jay Levitt <jay+news@...>

I was thinking about my "Detecting number ranges" question and the various

24 messages 2007/09/26
[#271317] Re: Confession: I never learned CS — Jay Levitt <jay+news@...> 2007/09/27

On Thu, 27 Sep 2007 23:57:08 +0900, Ilmari Heikkinen wrote:

[#271147] Syntax for <stringVariable>.new ? — Larry Fast <lfast@...>

Hi Rubyists and ...istas,

14 messages 2007/09/26
[#271148] Re: Syntax for <stringVariable>.new ? — Sebastian Hungerecker <sepp2k@...> 2007/09/26

Larry Fast wrote:

[#271212] Confession: I never did ASM — julik <listbox@...>

I would love to join the recently started confession fest.

57 messages 2007/09/27
[#271220] Re: [OT] Confession: I never did ASM — "M. Edward (Ed) Borasky" <znmeb@...> 2007/09/27

julik wrote:

[#271279] Re: [OT] Confession: I never did ASM — John Joyce <dangerwillrobinsondanger@...> 2007/09/27

[#271393] Re: [OT] Confession: I never did ASM — "M. Edward (Ed) Borasky" <znmeb@...> 2007/09/28

John Joyce wrote:

[#271403] Re: [OT] Confession: I never did ASM — John Joyce <dangerwillrobinsondanger@...> 2007/09/28

[#271412] Re: [OT] Confession: I never did ASM — "M. Edward (Ed) Borasky" <znmeb@...> 2007/09/28

John Joyce wrote:

[#271672] Re: Confession: I never did ASM — Brian Adkins <lojicdotcom@...> 2007/09/29

On Sep 27, 1:21 am, julik <list...@julik.nl> wrote:

[#271695] Re: Confession: I never did ASM — John Joyce <dangerwillrobinsondanger@...> 2007/09/29

[#272303] Re: Confession: I never did ASM — Brian Adkins <lojicdotcom@...> 2007/10/03

On Sep 29, 3:27 pm, John Joyce <dangerwillrobinsondan...@gmail.com>

[#272307] Re: Confession: I never did ASM — John Joyce <dangerwillrobinsondanger@...> 2007/10/03

[#272309] Re: Confession: I never did ASM — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/03

John Joyce wrote:

[#272322] Re: Confession: I never did ASM — John Joyce <dangerwillrobinsondanger@...> 2007/10/03

[#272325] Re: Confession: I never did ASM — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/03

John Joyce wrote:

[#272423] Re: Confession: I never did ASM — Chad Perrin <perrin@...> 2007/10/03

On Wed, Oct 03, 2007 at 02:08:02PM +0900, M. Edward (Ed) Borasky wrote:

[#272508] Re: Confession: I never did ASM — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/04

Chad Perrin wrote:

[#271356] is there to invoke 'previous' in Find? (or refresh the current path?) — "dtown22@..." <dtown22@...>

I am writing a small script which recursively goes down a dir

10 messages 2007/09/27

[#271360] mac - hpricot problems — Sergio Ruiz <sergio@...>

i am trying to get hpricot running (so i can run mechanize) and am

24 messages 2007/09/27
[#271368] Re: mac - hpricot problems — Daniel Waite <rabbitblue@...> 2007/09/27

Sergio Ruiz wrote:

[#271370] Re: mac - hpricot problems — Sergio Ruiz <sergio@...> 2007/09/28

[#271376] Re: mac - hpricot problems — Ryan Davis <ryand-ruby@...> 2007/09/28

[#271364] Re: Anyone interested In IronRuby — Phrogz <phrogz@...>

On Sep 26, 11:47 pm, IronRuby <rubyguja...@gmail.com> wrote:

12 messages 2007/09/27

[#271394] dike-0.0.1 - a memory leak detector — "ara.t.howard" <ara.t.howard@...>

19 messages 2007/09/28
[#271522] Re: [ANN] dike-0.0.1 - a memory leak detector — Joel VanderWerf <vjoel@...> 2007/09/28

ara.t.howard wrote:

[#271526] Re: [ANN] dike-0.0.1 - a memory leak detector — "ara.t.howard" <ara.t.howard@...> 2007/09/28

[#271467] Probable Iterations (#141) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

15 messages 2007/09/28

[#271472] Windows - Get current logged user — Rodrigo Bermejo <rodrigo.bermejo@...>

14 messages 2007/09/28

[#271499] a different type of reference (shocked) — SpringFlowers AutumnMoon <summercoolness@...>

Before, when I say Ruby's reference to an object

14 messages 2007/09/28

[#271617] how can I start a shell process and return immediately? — Stephen Bannasch <stephen.bannasch@...>

I want to start a Java program from a Ruby program and have the Java

16 messages 2007/09/29
[#341070] Re: how can I start a shell process and return immediately? — Enling Li <enling.li@...> 2009/07/09

I have another quetion related to fire off a back ground shell process

[#271649] Is there a combination of a struct and an array? I wanna iterate over all created objects from a certain struct-class (I guess). — kazaam <kazaam@...>

I have a file with many entries and much of these I don't need. Let's imagine:

8 messages 2007/09/29

[#271673] a = Dog.new # a is not a pointer and not a reference? — SpringFlowers AutumnMoon <summercoolness@...>

when we say

57 messages 2007/09/29
[#271677] Re: a = Dog.new # a is not a pointer and not a reference? — Morton Goldberg <m_goldberg@...> 2007/09/29

On Sep 29, 2007, at 1:16 PM, SpringFlowers AutumnMoon wrote:

[#271698] Re: a = Dog.new # a is not a pointer and not a reference? — "Austin Ziegler" <halostatue@...> 2007/09/29

On 9/29/07, Morton Goldberg <m_goldberg@ameritech.net> wrote:

[#271718] Re: a = Dog.new # a is not a pointer and not a reference? — Joel VanderWerf <vjoel@...> 2007/09/29

Austin Ziegler wrote:

[#271804] Re: a = Dog.new # a is not a pointer and not a reference? — "Austin Ziegler" <halostatue@...> 2007/09/30

On 9/29/07, Joel VanderWerf <vjoel@path.berkeley.edu> wrote:

[#271732] Re: a = Dog.new # a is not a pointer and not a reference? — SpringFlowers AutumnMoon <summercoolness@...> 2007/09/30

Austin Ziegler wrote:

[#271734] Re: a = Dog.new # a is not a pointer and not a reference? — SpringFlowers AutumnMoon <summercoolness@...> 2007/09/30

SpringFlowers AutumnMoon wrote:

[#271740] Re: a = Dog.new # a is not a pointer and not a reference? — Morton Goldberg <m_goldberg@...> 2007/09/30

On Sep 29, 2007, at 8:18 PM, SpringFlowers AutumnMoon wrote:

[#271738] Newbie needs help getting user input — Peter Vanderhaden <bostonantifan@...>

I'm trying to learn Ruby and trying to convert a Perl program at the

14 messages 2007/09/30

[#271776] Can you please help to make decision? — Byung-Hee HWANG <bh@...>

Fist of all, sorry for poor English, I am not professional English

34 messages 2007/09/30
[#271808] Re: Can you please help to make decision? — 7stud -- <dolgun@...> 2007/09/30

I would choose python.

[#271784] which language allows you to change an argument's value? — Summercool <Summercoolness@...>

34 messages 2007/09/30

Re: [QUIZ] Twisting a Rope (#137)

From: Mauricio Fernandez <mfp@...>
Date: 2007-09-03 08:52:31 UTC
List: ruby-talk #267312
On Fri, Aug 31, 2007 at 10:19:54PM +0900, Ruby Quiz wrote:
> by John Miller
> 
> This week's task is to implement the Rope data structure as a Ruby class.  This
> topic comes out of the ICFP programming competition
> (http://www.icfpcontest.com/) which had competitors manipulating a 7.5 million
> character string this year.

I happened to have implemented ropes in OCaml recently, so I generated a Ruby
extension using rocaml to see how well it would perform.

Without further ado, here are the results I'm getting for SIZE = 512 * 1024,
CHUNKS = 512:

$ time ruby -r himadri_choudhury.rb bm.rb Rope
Build:   0.130000   0.000000   0.130000 (  0.129476)
Sort:  10.340000   0.050000  10.390000 ( 10.648223)

$ time ruby -rocaml_rope bm.rb OCaml::Rope
Build:   0.020000   0.000000   0.020000 (  0.018946)
Sort:   0.100000   0.000000   0.100000 (  0.108499)

$ ruby eric_mahurin.rb StringRope
[...]
Build:   0.060000   0.000000   0.060000 (  0.057299)
Sort:   0.870000   0.000000   0.870000 (  0.896493)

For SIZE = 1024, CHUNKS = 16384:

$ ruby eric_mahurin.rb StringRope
[...]
Build:   3.470000   0.040000   3.510000 (  3.588875)
Sort:  89.110000   0.700000  89.810000 ( 92.179962)

$ time ruby -rocaml_rope bm.rb OCaml::Rope
[...]
Build:   0.360000   0.000000   0.360000 (  0.378352)
Sort:   3.940000   0.040000   3.980000 (  4.079140)

At that point the pure Ruby rope is taking over 6 times more memory than
the OCaml one. I ascribe this to iv_tbls being very heavy and to memory
fragmentation.

I benchmarked Himadri's implementation first and was surprised by the
exceedingly large speed difference --- I expected one, not two orders of
magnitude for this code, as there's enough Ruby code in common in qsort to
mask the speed gains in the rope operations. However, Eric's solution proved
that it was just due to a slow Ruby implementation.

Here's the interface definition (extconf.rb):


EXT_NAME = "ocaml_rope"
OCAML_PACKAGES = %w[]
CAML_LIBS = %w[]
CAML_OBJS = %w[]
CAML_FLAGS = ""
CAML_INCLUDES = []

require 'rocaml'

Interface.generate("ocaml_rope") do |iface|
  def_class("Rope", :under => "OCaml") do |c|
    rope = c.abstract_type

    fun "empty", UNIT => rope, :as => "new_empty"
    fun "of_string", STRING => rope, :as => "new_from_string"

    method "sub", [rope, INT, INT] => rope, :as => "slice"
    method "concat", [rope, rope] => rope
    method "length", rope => INT
    method "get", [rope, INT] => INT
    method "to_string", rope => STRING, :as => "to_s"
  end
end

require 'rocaml_extconf'


As you can see, OCaml::Rope is purely functional, and the interface differs a
bit from that expected by bm.rb (a modified version that works with immutable
ropes is attached), so I adapted it with the following ocaml_rope.rb, which
also loads the extension:


module OCaml # Rope will be placed in this module
end

require "ocaml_rope.so"

module OCaml
  class Rope
    def self.new(str = "")
      case str
      when String; new_from_string str
      when Rope; str
      when ""; new_empty
      else new_from_string(str.to_str) rescue new_from_string(str.to_s)
      end
    end

    def prepend(rope)
      rope.append(self)
    end

    alias_method :append, :concat
    alias_method :<<, :append
  end
end


The OCaml code is attached, in case anybody wants to look at it.
Incidentally, it weighs a bit under 220 lines, which is also the amount taken
by Himadri's and Eric's solutions. Unlike them, rope.ml features O(1)
concatenation for small elements; this accounts for a large part of the code
and the complexity of some patterns. O(1) concatenation doesn't really affect
performance in the use case exerted by bm.rb anyway.

-- 
Mauricio Fernandez  -   http://eigenclass.org

Attachments (2)

bm.rb (1.37 KB, text/x-ruby)
require 'benchmark'

#This code make a String/Rope of  CHUNKS chunks of text
#each chunck is SIZE bytes long.  Each chunk starts with
#an 8 byte number.  Initially the chunks are shuffled the
#qsort method sorts them into ascending order.
#
#pass the name of the class to use as a parameter
#ruby -r rope.rb this_file Rope

puts 'preparing data...'
TextClass = (ARGV.shift || "String").split(/::/).inject(Object){|s,x| s.const_get(x)}

def qsort(text)
  return TextClass.new if text.length == 0
  pivot = text.slice(0,8).to_s.to_i
  less = TextClass.new
  more = TextClass.new
  offset = 8+SIZE
  while (offset < text.length)
    i = text.slice(offset,8).to_s.to_i
    if i < pivot
      less <<= text.slice(offset,8+SIZE)
    else
      more <<= text.slice(offset,8+SIZE)
    end
    offset = offset + 8+SIZE
  end
  #print "*"
  return qsort(less) << text.slice(0,8+SIZE) << qsort(more)
end

SIZE  = 1 * 1024
CHUNKS = 32768
CHARS = %w[R O P E]
data = TextClass.new
bulk_string =
  TextClass.new(Array.new(SIZE) { CHARS[rand(4)] }.join)
puts 'Building Text...'
build = Benchmark.measure do
  (0..CHUNKS).sort_by { rand }.each do |n|
    data = data << TextClass.new(sprintf("%08i",n)) << bulk_string
  end
  data = data.normalize  if data.respond_to? :normalize
end
GC.start
sort = Benchmark.measure do
  puts "Sorting Text..."
  qsort(data)
  puts"\nEND"
end

puts "Build: #{build}Sort: #{sort}"

rope.ml (6.46 KB, text/x-ml)
type t =
    Empty
  (* left, left size, right, right size, height *)
  | Concat of t * int * t * int * int
  | Leaf of string

type forest_element = { mutable c : t; mutable len : int }

let str_append = (^)
let empty_str = ""
let string_of_string_list l = String.concat "" l

let max_height = 48

let leaf_size = 256

exception Out_of_bounds

let empty = Empty

(* by construction, there cannot be Empty or Leaf "" leaves *)
let is_empty = function Empty -> true | _ -> false

let height = function
    Empty | Leaf _ -> 0
  | Concat(_,_,_,_,h) -> h

let rec length = function
    Empty -> 0
  | Leaf s -> String.length s
  | Concat(_,cl,_,cr,_) -> cl + cr

let make_concat l r =
  let hl = height l and hr = height r in
  let cl = length l and cr = length r in
    Concat(l, cl, r, cr, if hl >= hr then hl + 1 else hr + 1)

let min_len =
  let fib_tbl = Array.make max_height 0 in
  let rec fib n = match fib_tbl.(n) with
      0 ->
        let last = fib (n - 1) and prev = fib (n - 2) in
        let r = last + prev in
        let r = if r > last then r else last in (* check overflow *)
          fib_tbl.(n) <- r; r
    | n -> n
  in
    fib_tbl.(0) <- leaf_size + 1; fib_tbl.(1) <- 3 * leaf_size / 2 + 1;
    Array.init max_height (fun i -> if i = 0 then 1 else fib (i - 1))

let max_length = min_len.(Array.length min_len - 1)

let concat_fast l r = match l with
    Empty -> r
  | Leaf _ | Concat(_,_,_,_,_) ->
      match r with
          Empty -> l
        | Leaf _ | Concat(_,_,_,_,_) -> make_concat l r

(* based on Hans-J. Boehm's *)
let add_forest forest rope len =
  let i = ref 0 in
  let sum = ref empty in
    while len > min_len.(!i+1) do
      if forest.(!i).c <> Empty then begin
        sum := concat_fast forest.(!i).c !sum;
        forest.(!i).c <- Empty
      end;
      incr i
    done;
    sum := concat_fast !sum rope;
    let sum_len = ref (length !sum) in
      while !sum_len >= min_len.(!i) do
        if forest.(!i).c <> Empty then begin
          sum := concat_fast forest.(!i).c !sum;
          sum_len := !sum_len + forest.(!i).len;
          forest.(!i).c <- Empty;
        end;
        incr i
      done;
      decr i;
      forest.(!i).c <- !sum;
      forest.(!i).len <- !sum_len

let concat_forest forest =
  Array.fold_left (fun s x -> concat_fast x.c s) Empty forest

let rec balance_insert rope len forest = match rope with
    Empty -> ()
  | Leaf _ -> add_forest forest rope len
  | Concat(l,cl,r,cr,h) when h >= max_height || len < min_len.(h) ->
      balance_insert l cl forest;
      balance_insert r cr forest
  | x -> add_forest forest x len (* function or balanced *)

let balance r =
  match r with
      Empty -> Empty
    | Leaf _ -> r
    | _ ->
        let forest = Array.init max_height (fun _ -> {c = Empty; len = 0}) in
          balance_insert r (length r) forest;
          concat_forest forest

let bal_if_needed l r =
  let r = make_concat l r in
    if height r < max_height then r else balance r

let concat_str l = function
    Empty | Concat(_,_,_,_,_) -> invalid_arg "concat_str"
  | Leaf rs as r ->
      let lenr = String.length rs in
        match l with
          | Empty -> r
          | Leaf ls ->
              let slen = lenr + String.length ls in
                if slen <= leaf_size then Leaf (str_append ls rs)
                else make_concat l r (* height = 1 *)
          | Concat(ll, cll, Leaf lrs, clr, h) ->
              let slen = clr + lenr in
                if clr + lenr <= leaf_size then
                  Concat(ll, cll, Leaf (str_append lrs rs), slen, h)
                else
                  bal_if_needed l r
          | _ -> bal_if_needed l r

let append_char c r = concat_str r (Leaf (String.make 1 c))

let concat l = function
    Empty -> l
  | Leaf _ as r -> concat_str l r
  | Concat(Leaf rls,rlc,rr,rc,h) as r ->
      (match l with
          Empty -> r
        | Concat(_,_,_,_,_) -> bal_if_needed l r
        | Leaf ls ->
            let slen = rlc + String.length ls in
              if slen <= leaf_size then
                Concat(Leaf(str_append ls rls), slen, rr, rc, h)
              else
                bal_if_needed l r)
  | r -> (match l with Empty -> r | _ -> bal_if_needed l r)

let prepend_char c r = concat (Leaf (String.make 1 c)) r

let rec get i = function
    Empty -> raise Out_of_bounds
  | Leaf s ->
      if i >= 0 && i < String.length s then String.unsafe_get s i
      else raise Out_of_bounds
  | Concat (l, cl, r, cr, _) ->
      if i < cl then get i l
      else get (i - cl) r

let of_string = function
    s when String.length s = 0 -> Empty
  | s ->
      let min (x:int) (y:int) = if x <= y then x else y in
      let rec loop r s len i =
        if i < len then (* len - i > 0, thus Leaf "" can't happen *)
          loop (concat r (Leaf (String.sub s i (min (len - i) leaf_size))))
            s len (i + leaf_size)
        else
          r
      in loop Empty s (String.length s) 0

let rec sub start len = function
    Empty -> if start <> 0 || len <> 0 then raise Out_of_bounds else Empty
  | Leaf s ->
      if len > 0 then (* Leaf "" cannot happen *)
        (try Leaf (String.sub s start len) with _ -> raise Out_of_bounds)
      else if len < 0 || start < 0 || start > String.length s then
        raise Out_of_bounds
      else Empty
  | Concat(l,cl,r,cr,_) ->
      if start < 0 || len < 0 || start + len > cl + cr then raise Out_of_bounds;
      let left =
        if start = 0 then
          if len >= cl then
            l
          else sub 0 len l
        else if start > cl then Empty
        else if start + len >= cl then
          sub start (cl - start) l
        else sub start len l in
      let right =
        if start <= cl then
          let upto = start + len in
            if upto = cl + cr then r
            else if upto < cl then Empty
            else sub 0 (upto - cl) r
        else sub (start - cl) len r
      in
        concat left right

let to_string r =
  let rec strings l = function
      Empty -> l
    | Leaf s -> s :: l
    | Concat(left,_,right,_,_) -> strings (strings l right) left
  in
    string_of_string_list (strings [] r)

let insert start rope r =
  concat (concat (sub 0 start r) rope) (sub start (length r - start) r)

let remove start len r =
  concat (sub 0 start r) (sub (start + len) (length r - start - len) r)

let () =
  let r name v = Callback.register ("Rope." ^ name) v in
    r "empty"     (fun () -> empty);
    r "of_string" of_string;
    r "sub"       (fun r n m -> sub n m r);
    r "concat"    concat;
    r "length"    length;
    r "get"       (fun r i -> get i r);
    r "to_string" to_string

In This Thread