[#271943] Ruby vs. PHP — Marcin Raczkowski <mailing.mr@...>

Hello

63 messages 2007/10/01
[#271948] Re: Ruby vs. PHP — "Richard Conroy" <richard.conroy@...> 2007/10/01

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

[#272001] Re: Ruby vs. PHP — Marcin Raczkowski <mailing.mr@...> 2007/10/01

Richard Conroy wrote:

[#272003] Re: Ruby vs. PHP — Marc Heiler <shevegen@...> 2007/10/01

Finally a topic I like :)

[#271996] Reference vs. Reference — "Robert Klemme" <shortcutter@...>

I feel there is a subtle point that needs clarification.

27 messages 2007/10/01
[#272607] Re: Reference vs. Reference — Paul Brannan <pbrannan@...> 2007/10/04

On Tue, Oct 02, 2007 at 12:29:37AM +0900, Robert Klemme wrote:

[#272138] a = b = c order of evaluation weird — SpringFlowers AutumnMoon <summercoolness@...>

i thought if it is

25 messages 2007/10/02
[#272140] Re: a = b = c order of evaluation weird — 7stud -- <dolgun@...> 2007/10/02

SpringFlowers AutumnMoon wrote:

[#272141] Re: a = b = c order of evaluation weird — 7stud -- <dolgun@...> 2007/10/02

7stud -- wrote:

[#272329] Searching through a sorted array — FireAphis <FireAphis@...>

Hello,

16 messages 2007/10/03

[#272427] Non-blocking 'gets' ? — Stephen Ware <sgware@...>

Hi guys, sorry if this is a stupid question, but I've been reading

27 messages 2007/10/03
[#272458] Re: Non-blocking 'gets' ? — 7stud -- <dolgun@...> 2007/10/03

Stephen Ware wrote:

[#272496] opinion on a simple method — Lloyd Linklater <lloyd@2live4.com>

I am trying to find the better way to do things ruby style. I needed to

15 messages 2007/10/04

[#272529] cygwin's Ruby (was: Re: Whats going on!?!?) — "Robert Klemme" <shortcutter@...>

2007/10/2, Phlip <phlip2005@gmail.com>:

20 messages 2007/10/04
[#272552] Re: cygwin's Ruby — Jay Levitt <jay+news@...> 2007/10/04

On Thu, 4 Oct 2007 18:15:36 +0900, Robert Klemme wrote:

[#272581] Re: cygwin's Ruby — "Garry Offord" <droffo@...> 2007/10/04

It's good to know that somebody has successfully done this. I've tried in

[#272589] Re: cygwin's Ruby — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/04

Garry Offord wrote:

[#272740] Itinerary for a Traveling Salesman (#142) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

20 messages 2007/10/05

[#272803] The Case for Multiple-Inheritance — Trans <transfire@...>

So I working on little lib that's ripe for an adapter pattern, when I

71 messages 2007/10/05
[#272918] Re: The Case for Multiple-Inheritance — MenTaLguY <mental@...> 2007/10/06

On Sat, 2007-10-06 at 19:17 +0900, Sylvain Joyeux wrote:

[#272924] Re: The Case for Multiple-Inheritance — Sylvain Joyeux <sylvain.joyeux@...> 2007/10/06

On Saturday 06 October 2007, MenTaLguY wrote:

[#272928] Re: The Case for Multiple-Inheritance — James Edward Gray II <james@...> 2007/10/06

On Oct 6, 2007, at 3:55 PM, Sylvain Joyeux wrote:

[#272979] Re: The Case for Multiple-Inheritance — Sylvain Joyeux <sylvain.joyeux@...> 2007/10/07

> Delegation does not mean duck typing. You are confusing your

[#273018] Re: The Case for Multiple-Inheritance — "Austin Ziegler" <halostatue@...> 2007/10/07

On 10/6/07, Trans <transfire@gmail.com> wrote:

[#273030] Re: The Case for Multiple-Inheritance — Trans <transfire@...> 2007/10/07

[#273120] Re: The Case for Multiple-Inheritance — "Austin Ziegler" <halostatue@...> 2007/10/08

On 10/7/07, Trans <transfire@gmail.com> wrote:

[#273132] Re: The Case for Multiple-Inheritance — Trans <transfire@...> 2007/10/08

[#273185] Re: The Case for Multiple-Inheritance — "Austin Ziegler" <halostatue@...> 2007/10/08

On 10/8/07, Trans <transfire@gmail.com> wrote:

[#272894] Can I do this perl code the same in ruby? — kazaam <kazaam@...>

Well I'm trying to "translate" a perl program to ruby and everything worked fine until the near end where I'm now. There we have this perl code:

14 messages 2007/10/06

[#272904] Ternary Usage — Greg Willits <lists@...>

New to Ruby. Having trouble with ternary statements.

13 messages 2007/10/06

[#272952] The old File.rename not working again. . . . — Peter Bailey <pbailey@...>

This always throws me. I keep getting "permission denied" messages when

24 messages 2007/10/07

[#272954] Hiding source code — |MKSM| <mksm.sama@...>

Hello.

17 messages 2007/10/07

[#272982] #sort_by and #sort_obj — Eric Hodel <drbrain@...7.net>

I haven't seen this technique in the wild before.

18 messages 2007/10/07

[#273052] Obfuscator for Ruby/RoR — "Igor K." <testmyeclipse@...>

Hello,

35 messages 2007/10/07
[#273270] Re: Obfuscator for Ruby/RoR — Ryan Davis <ryand-ruby@...> 2007/10/08

[#273308] Re: Obfuscator for Ruby/RoR — John Joyce <dangerwillrobinsondanger@...> 2007/10/09

[#273382] Re: Obfuscator for Ruby/RoR — mortee <mortee.lists@...> 2007/10/09

John Joyce wrote:

[#273403] Re: Obfuscator for Ruby/RoR — Eric Hodel <drbrain@...7.net> 2007/10/09

On Oct 9, 2007, at 09:22 , mortee wrote:

[#273057] considering writing a book on Ruby/Rails? — "Eric H." <REMOVE-CAPSburnFORout@...>

If anyone here is considering writing a book on Ruby or Rails I'd like

41 messages 2007/10/07
[#273063] Re: considering writing a book on Ruby/Rails? — "Phlip" <phlip2005@...> 2007/10/07

> I hate to gripe but as of today I'm at Ruby/Rails book number 7 and it

[#273069] Re: considering writing a book on Ruby/Rails? — John Joyce <dangerwillrobinsondanger@...> 2007/10/07

[#273079] Re: considering writing a book on Ruby/Rails? — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/07

John Joyce wrote:

[#273109] Translation Service — James Edward Gray II <james@...>

Sorry for being off topic, but I know so many of you know more

16 messages 2007/10/08

[#273152] Bug: Numeric#divmod calculates wrongly — "Dirk Traulsen" <dirk.traulsen@...>

Hi all!

13 messages 2007/10/08
[#274036] Re: Bug: Numeric#divmod calculates wrongly — "Dirk Traulsen" <dirk.traulsen@...> 2007/10/14

Am 8 Oct 2007 um 19:49 hat Dirk Traulsen geschrieben:

[#273154] MATRIX PROBLEMS (AGAIN!) — "John Nott" <JNott@...>

Hi everyone,=20

15 messages 2007/10/08
[#273172] Re: MATRIX PROBLEMS (AGAIN!) — 7stud -- <dolgun@...> 2007/10/08

John Nott wrote:

[#273175] Re: MATRIX PROBLEMS (AGAIN!) — 7stud -- <dolgun@...> 2007/10/08

7stud -- wrote:

[#273158] regexp question - look for parentheses then remove them — Max Williams <toastkid.williams@...>

I'm struggling with a regular expression problem, can anyone help?

12 messages 2007/10/08
[#273160] Re: regexp question - look for parentheses then remove them — "Jes俍 Gabriel y Gal疣" <jgabrielygalan@...> 2007/10/08

On 10/8/07, Max Williams <toastkid.williams@gmail.com> wrote:

[#273265] parts of speech in Ruby — Chad Perrin <perrin@...>

I'm curious -- exactly what class of syntactic element is `=` in Ruby,

13 messages 2007/10/08

[#273305] The Open-Closed-from-a-certain-angle Principle — Jay Levitt <jay+news@...>

Let me start off by saying that I'm SURE this is either a bad idea,

17 messages 2007/10/09

[#273423] Finding shared elements between to arrays. — Sebastian probst Eide <sebastian.probst.eide@...>

Hi

14 messages 2007/10/09

[#273453] will #in? be in ruby2? (was Re: Finding shared elements between to arrays.) — Pe, Botp <botp@...>

Eric wrote:

14 messages 2007/10/10
[#273460] Re: will #in? be in ruby2? (was Re: Finding shared elements between to arrays.) — "Devi Web Development" <devi.webmaster@...> 2007/10/10

T24gMTAvOS8wNywgUGXDsWEsIEJvdHAgPGJvdHBAZGVsbW9udGUtcGhpbC5jb20+IHdyb3RlOgo+

[#273466] Re: will #in? be in ruby2? (was Re: Finding shared elements between to arrays.) — Peña, Botp <botp@...> 2007/10/10

RnJvbTogRGV2aSBXZWIgRGV2ZWxvcG1lbnQgW21haWx0bzpkZXZpLndlYm1hc3RlckBnbWFpbC5j

[#273481] Inter-Process Messaging — Daniel DeLorme <dan-ml@...42.com>

What are the possibilities in ruby for passing information from one

32 messages 2007/10/10
[#273566] Re: Inter-Process Messaging — Joel VanderWerf <vjoel@...> 2007/10/10

Daniel DeLorme wrote:

[#273556] RubyGems Installation Problem on Solaris 10 — cratervoid@...

I've installed Ruby 1.8.6 on a Solaris 10 server without a problem.

10 messages 2007/10/10

[#273575] what does print call internally? — "Martin DeMello" <martindemello@...>

irb(main):001:0> puts nil

14 messages 2007/10/10
[#273584] Re: what does print call internally? — Eric Hodel <drbrain@...7.net> 2007/10/11

On Oct 10, 2007, at 15:31 , Martin DeMello wrote:

[#273612] Why does this use a block — "Anonymous" <jaimrk@...>

So I'm new to Ruby and I'm trying to use OptionParser to parse in some

13 messages 2007/10/11

[#273630] Should *most* memory be release back to the system? — Blackie <mudsweatandears@...>

If anyone can explain this I would appreciate it.

50 messages 2007/10/11
[#273638] Re: Should *most* memory be release back to the system? — Yohanes Santoso <ysantoso-rubytalk@...> 2007/10/11

Blackie <mudsweatandears@gmail.com> writes:

[#273655] Re: Should *most* memory be release back to the system? — "ara.t.howard" <ara.t.howard@...> 2007/10/11

[#274671] Re: [OT] Re: Should *most* memory be release back to the system? — Yohanes Santoso <ysantoso-rubytalk@...> 2007/10/18

"ara.t.howard" <ara.t.howard@gmail.com> writes:

[#274699] Re: [OT] Re: Should *most* memory be release back to the system? — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/18

Yohanes Santoso wrote:

[#274705] Re: [OT] Re: Should *most* memory be release back to the system? — Yohanes Santoso <ysantoso-rubytalk@...> 2007/10/18

"M. Edward (Ed) Borasky" <znmeb@cesmail.net> writes:

[#274709] Re: [OT] Re: Should *most* memory be release back to the system? — "ara.t.howard" <ara.t.howard@...> 2007/10/18

[#274761] Re: [OT] Re: Should *most* memory be release back to the system? — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/19

ara.t.howard wrote:

[#274810] Re: [OT] Re: Should *most* memory be release back to the system? — khaines@... 2007/10/19

On Fri, 19 Oct 2007, M. Edward (Ed) Borasky wrote:

[#274826] Re: [OT] Re: Should *most* memory be release back to the system? — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/19

khaines@enigo.com wrote:

[#274884] Re: [OT] Re: Should *most* memory be release back to the system? — "Michal Suchanek" <hramrach@...> 2007/10/19

On 19/10/2007, M. Edward (Ed) Borasky <znmeb@cesmail.net> wrote:

[#274942] Why don't we have "C" machines? (was Re: [OT] Re: Should *most* memory be release back to the system?) — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/20

Michal Suchanek wrote:

[#275118] Re: Why don't we have "C" machines? (was Re: [OT] Re: Should *most* memory be release back to the system?) — "Michal Suchanek" <hramrach@...> 2007/10/21

On 20/10/2007, M. Edward (Ed) Borasky <znmeb@cesmail.net> wrote:

[#275170] Re: Why don't we have "C" machines? (was Re: [OT] Re: Should *most* memory be release back to the system?) — "Martin DeMello" <martindemello@...> 2007/10/22

On 10/21/07, Michal Suchanek <hramrach@centrum.cz> wrote:

[#275223] Re: Why don't we have "C" machines? (was Re: [OT] Re: Should *most* memory be release back to the system?) — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/22

Martin DeMello wrote:

[#275227] Re: Why don't we have "C" machines? (was Re: [OT] Re: Should *most* memory be release back to the system?) — Xavier Noria <fxn@...> 2007/10/22

On Oct 22, 2007, at 4:23 PM, M. Edward (Ed) Borasky wrote:

[#273707] How to delete specific characters from a string? — Bazsl <hs@...>

Is there really no method that allows me to delete N characters starting

13 messages 2007/10/11

[#273718] range max — Marek Kasperkiewicz <m.kasperkiewicz@...>

If i try this

31 messages 2007/10/12
[#273727] Re: range max — Brian Adkins <lojicdotcom@...> 2007/10/12

On Oct 11, 9:30 pm, Marek Kasperkiewicz <m.kasperkiew...@gmail.com>

[#273800] Re: range max — Yossef Mendelssohn <ymendel@...> 2007/10/12

On Oct 11, 9:55 pm, Brian Adkins <lojicdot...@gmail.com> wrote:

[#273823] Re: range max — Brian Adkins <lojicdotcom@...> 2007/10/12

On Oct 12, 8:56 am, Yossef Mendelssohn <ymen...@pobox.com> wrote:

[#273755] Syntax error when redefining >> operator to take a block — John Woods <jqwoods@...>

I'm trying to redefine the >> operator for a particular class such that

9 messages 2007/10/12

[#273828] ANN: English 0.1 — Trans <transfire@...>

English 0.1

17 messages 2007/10/12

[#273887] Is there a standard pattern for threaded access to a file? — Jon Handler <jhandler@...>

I'm pretty new to ruby and this is one of those areas where I can't

37 messages 2007/10/12
[#273891] Re: Is there a standard pattern for threaded access to a file? — "ara.t.howard" <ara.t.howard@...> 2007/10/13

[#273896] Re: Is there a standard pattern for threaded access to a file? — 7stud -- <bbxx789_05ss@...> 2007/10/13

ara.t.howard wrote:

[#273940] Re: Is there a standard pattern for threaded access to a file? — "Francis Cianfrocca" <garbagecat10@...> 2007/10/13

On 10/12/07, Jon Handler <jhandler@shopping.com> wrote:

[#273955] Re: Is there a standard pattern for threaded access to a file? — Eric Hodel <drbrain@...7.net> 2007/10/13

On Oct 13, 2007, at 07:29 , Francis Cianfrocca wrote:

[#273974] Re: Is there a standard pattern for threaded access to a file? — Brian Adkins <lojicdotcom@...> 2007/10/13

On Oct 13, 1:32 pm, Eric Hodel <drbr...@segment7.net> wrote:

[#273919] RubyGems Beta 0.9.4.5 — Eric Hodel <drbrain@...7.net>

RubyGems 0.9.4.5 is a beta release for the upcoming 0.9.5 which adds

13 messages 2007/10/13

[#273980] top 10 last played mp3's — Robin Wagenaar <robin87_msn@...>

Hello everyone,

18 messages 2007/10/13
[#273983] Re: top 10 last played mp3's — "Andreas S." <x-ruby-forum.com@...> 2007/10/13

Robin Wagenaar wrote:

[#273995] Re: top 10 last played mp3's — Konrad Meyer <konrad@...> 2007/10/13

Quoth Andreas S.:

[#273984] write_noblock is blocking? — Christoffer Lern<lerno@...>

Anyone know what's up with TCPSocket#write_noblock actually blocking

15 messages 2007/10/13

[#274031] Mac OS X Tiger comes with Tk? — SpringFlowers AutumnMoon <summercoolness@...>

I thought it is said that Mac OS X Tiger comes with Tk?

23 messages 2007/10/14
[#274032] Re: Mac OS X Tiger comes with Tk? — Ben Bleything <ben@...> 2007/10/14

On Sun, Oct 14, 2007, SpringFlowers AutumnMoon wrote:

[#274062] MIT vs. Ruby/GPL License — Trans <transfire@...>

Rails uses the MIT license. The Ruby license is essentially the GPL

46 messages 2007/10/14
[#274075] Re: MIT vs. Ruby/GPL License — Randy Kramer <rhkramer@...> 2007/10/14

On Sunday 14 October 2007 09:31 am, Trans wrote:

[#274080] Re: MIT vs. Ruby/GPL License — Trans <transfire@...> 2007/10/14

[#274093] Re: MIT vs. Ruby/GPL License — "Terry Poulin" <bigboss64@...> 2007/10/14

I don't think the difference between MIT and GPL License has much purpose in

[#274098] Re: MIT vs. Ruby/GPL License — Trans <transfire@...> 2007/10/14

[#274066] Parameter in a block is not local? — SpringFlowers AutumnMoon <summercoolness@...>

I thought a iterator with a block is like an nameless function call...

21 messages 2007/10/14

[#274120] nil.to_i returning zero — "Gerardo Santana Gez Garrido" <gerardo.santana@...>

zero in Ruby is true, not false, in a boolean context.

38 messages 2007/10/14
[#274289] Re: nil.to_i returning zero — "Gerardo Santana Gez Garrido" <gerardo.santana@...> 2007/10/15

John Joyce wrote:

[#274227] Re: [ANN] RubyTraits 0.1 — Yukihiro Matsumoto <matz@...>

Hi,

22 messages 2007/10/15
[#274239] Re: RubyTraits 0.1 — Trans <transfire@...> 2007/10/15

[#274242] Re: RubyTraits 0.1 — Yukihiro Matsumoto <matz@...> 2007/10/15

Hi,

[#274244] Re: RubyTraits 0.1 — Trans <transfire@...> 2007/10/15

[#274236] ruby wish-list — Roger Pack <rogerpack2005@...>

My personal ruby wish-list (for any feedback):

177 messages 2007/10/15
[#274243] Re: ruby wish-list — Yukihiro Matsumoto <matz@...> 2007/10/15

Hi,

[#274245] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2007/10/15

Thanks Matz.

[#274263] Re: ruby wish-list — Robert Klemme <shortcutter@...> 2007/10/15

On 15.10.2007 17:24, Roger Pack wrote:

[#274264] Re: ruby wish-list — Robert Klemme <shortcutter@...> 2007/10/15

On 15.10.2007 18:45, Robert Klemme wrote:

[#274271] Re: ruby wish-list — James Tucker <jftucker@...> 2007/10/15

I don't really see the reason why the GC would need or want a specific thread to itself - for a start, such a design makes the system slower on low end systems. There may also be cases where it is possible to choose 'optimal' times to run the GC within a single thread context.

[#274282] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2007/10/15

So you'd prefer a few tweaks:

[#274721] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2007/10/18

GC wish list:

[#274898] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2007/10/19

Roger Pack wrote:

[#274910] Re: ruby wish-list — Suraj Kurapati <snk@...> 2007/10/19

Oh, wishing star! Here are my wishes:

[#277588] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2007/11/05

Suraj Kurapati wrote:

[#277760] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2007/11/06

> Take care.

[#277902] Re: ruby wish-list — "Rick DeNatale" <rick.denatale@...> 2007/11/07

On 11/6/07, Roger Pack <rogerpack2005@gmail.com> wrote:

[#278435] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2007/11/11

>> I wish... that Range.to_a wouldn't become obselete, as it seems quite useful

[#278460] Re: ruby wish-list — "Rick DeNatale" <rick.denatale@...> 2007/11/11

On Nov 11, 2007 1:13 AM, Roger Pack <rogerpack2005@gmail.com> wrote:

[#278461] Re: ruby wish-list — Marc Heiler <shevegen@...> 2007/11/11

"unless you wanted to introduce ';'s to ruby too:"

[#279154] Re: ruby wish-list — Suraj Kurapati <snk@...> 2007/11/15

Marc Heiler wrote:

[#279174] Re: ruby wish-list — "Todd Benson" <caduceass@...> 2007/11/15

On Nov 15, 2007 11:48 AM, Suraj Kurapati <snk@gna.org> wrote:

[#279181] Re: ruby wish-list — Suraj Kurapati <snk@...> 2007/11/15

Todd Benson wrote:

[#279189] Re: ruby wish-list — James Britt <james.britt@...> 2007/11/15

Suraj Kurapati wrote:

[#279197] Re: ruby wish-list — "Rick DeNatale" <rick.denatale@...> 2007/11/15

On Nov 15, 2007 5:30 PM, James Britt <james.britt@gmail.com> wrote:

[#279203] Re: ruby wish-list — "Todd Benson" <caduceass@...> 2007/11/16

On Nov 15, 2007 5:28 PM, Rick DeNatale <rick.denatale@gmail.com> wrote:

[#279213] Re: ruby wish-list — James Britt <james.britt@...> 2007/11/16

Todd Benson wrote:

[#279226] Re: ruby wish-list — Suraj Kurapati <snk@...> 2007/11/16

James Britt wrote:

[#279232] Re: ruby wish-list — James Britt <james.britt@...> 2007/11/16

Suraj Kurapati wrote:

[#279318] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2007/11/16

> I'm arguing that methods that end in "?" should be designed and used as

[#279348] Re: ruby wish-list — "Todd Benson" <caduceass@...> 2007/11/16

On Nov 16, 2007 9:26 AM, Roger Pack <rogerpack2005@gmail.com> wrote:

[#281415] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2007/11/30

My latest wish for the wishing tree...

[#281422] Re: ruby wish-list — Trans <transfire@...> 2007/11/30

[#281423] Re: ruby wish-list — "Paul McMahon" <pm@...> 2007/11/30

On Fri, 30 Nov 2007 12:06:18 +0900, Trans <transfire@gmail.com> wrote:

[#281427] Re: ruby wish-list — Trans <transfire@...> 2007/11/30

[#286855] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/01/09

My biggest wish list currently is...I wish I didn't have to use # within

[#286856] Re: ruby wish-list — "Alex LeDonne" <aledonne.listmail@...> 2008/01/09

On Jan 9, 2008 2:37 PM, Roger Pack <rogerpack2005@gmail.com> wrote:

[#288183] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/01/21

[#288228] Re: ruby wish-list — "Robert Klemme" <shortcutter@...> 2008/01/22

2008/1/21, Roger Pack <rogerpack2005@gmail.com>:

[#288267] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/01/22

Robert Klemme wrote:

[#289182] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/01/30

I know this is controversial, but I wish that if you did

[#289229] Re: ruby wish-list — Chad Perrin <perrin@...> 2008/01/30

On Thu, Jan 31, 2008 at 04:34:49AM +0900, Roger Pack wrote:

[#309521] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/07/29

> Now you know you can.

[#295325] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/03/21

Roger Pack wrote:

[#295469] Re: ruby wish-list — Nobuyoshi Nakada <nobu@...> 2008/03/24

Hi,

[#296028] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/03/27

Next wish :)

[#296030] Re: ruby wish-list — "Thomas Wieczorek" <wieczo.yo@...> 2008/03/27

On Fri, Mar 28, 2008 at 12:21 AM, Roger Pack <rogerpack2005@gmail.com> wrote:

[#296031] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/03/27

> You want to create a two-dimensional array, right?

[#296035] Re: ruby wish-list — Tim Hunter <TimHunter@...> 2008/03/27

Roger Pack wrote:

[#296067] Re: ruby wish-list — Damjan Rems <d_rems@...> 2008/03/28

[#296083] Re: ruby wish-list — "Thomas Wieczorek" <wieczo.yo@...> 2008/03/28

On Fri, Mar 28, 2008 at 8:34 AM, Damjan Rems <d_rems@yahoo.com> wrote:

[#296810] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/04/02

> Ruby 1.9 supports named parameters, but I don't know anything about

[#296813] Re: ruby wish-list — Gary Wright <gwtmp01@...> 2008/04/02

[#296815] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/04/02

Gary Wright wrote:

[#296854] Re: ruby wish-list — Chad Perrin <perrin@...> 2008/04/02

On Thu, Apr 03, 2008 at 02:06:21AM +0900, Roger Pack wrote:

[#306230] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/06/25

[#298009] Re: ruby wish-list — Chris Shea <cmshea@...> 2008/04/12

On Apr 12, 10:49 am, Roger Pack <rogerpack2...@gmail.com> wrote:

[#298058] Re: ruby wish-list — Robert Klemme <shortcutter@...> 2008/04/13

On 12.04.2008 20:40, Chris Shea wrote:

[#298237] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/04/15

[#299044] Re: ruby wish-list — Roger Pack <roger@...> 2008/04/21

I wish this worked :)

[#299045] Re: ruby wish-list — "Robert Klemme" <shortcutter@...> 2008/04/21

2008/4/21, Roger Pack <roger@doachristianturndaily.info>:

[#299933] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/04/29

Robert Klemme wrote:

[#301521] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/05/12

All right ruby-genie. My next wish!

[#302766] Re: ruby wish-list — Roger Pack <rogerpack2005@...> 2008/05/23

Back to the wishing well...

[#274338] A Ruby/Rails bibliography — "Jeremy McAnally" <jeremymcanally@...>

Howdy all,

13 messages 2007/10/15

[#274374] equal? versus eql? versus == versus === verus <=> — Paul Butcher <paul@...>

I recently found myself explaining to a friend how Ruby's various

13 messages 2007/10/16

[#274400] How to remove "~" in those files — Vidya Vidya <vidhu1232001@...>

14 messages 2007/10/16

[#274426] Struct is slow — Wayne Magor <wemagor2@...>

I have a script in which I was using a 2-element array where a struct

20 messages 2007/10/16
[#274430] Re: Struct is slow — Alex Fenton <aff28@...> 2007/10/16

Wayne Magor wrote:

[#274460] Compound conditionals in case when statements? Syntax? — Randy Kramer <rhkramer@...>

I need (or want ;-) to do something like the following:

12 messages 2007/10/16

[#274461] recommendations for working with PostgreSQL — Chad Perrin <perrin@...>

I have need to work with PostgreSQL via Ruby. What gems/modules do you

13 messages 2007/10/16

[#274470] Mind giving a little help? — Tj Superfly <nonstickglue@...>

Hello everyone! I posted a topic a few days go and got an answer, and I

13 messages 2007/10/16
[#274475] Re: Mind giving a little help? — Ben Giddings <bg-rubytalk@...> 2007/10/17

On Oct 16, 2007, at 19:56, Tj Superfly wrote:

[#274561] rocaml 0.6.0: fast, easy Ruby extensions in Objective Caml — Mauricio Fernandez <mfp@...>

16 messages 2007/10/17
[#274604] Re: rocaml 0.6.0: fast, easy Ruby extensions in Objective Caml — Daniel Berger <djberg96@...> 2007/10/17

[#274611] Re: rocaml 0.6.0: fast, easy Ruby extensions in Objective Caml — Daniel Berger <djberg96@...> 2007/10/17

[#274619] Re: rocaml 0.6.0: fast, easy Ruby extensions in Objective Caml — Mauricio Fernandez <mfp@...> 2007/10/17

On Thu, Oct 18, 2007 at 04:48:13AM +0900, Daniel Berger wrote:

[#274571] extracting values from consecutive lines — baptiste Augui<ba208@...>

16 messages 2007/10/17

[#274615] Class instance variable idiom — Perry Smith <pedz@...>

I am using this technique for class instance variables:

27 messages 2007/10/17
[#274650] Re: Class instance variable idiom — Brian Adkins <lojicdotcom@...> 2007/10/18

On Oct 17, 4:10 pm, Perry Smith <p...@easesoftware.com> wrote:

[#274661] Re: Class instance variable idiom — "Robert Klemme" <shortcutter@...> 2007/10/18

2007/10/18, Brian Adkins <lojicdotcom@gmail.com>:

[#274708] Re: Class instance variable idiom — Brian Adkins <lojicdotcom@...> 2007/10/18

On Oct 18, 2:44 am, "Robert Klemme" <shortcut...@googlemail.com>

[#274717] Re: Class instance variable idiom — "David A. Black" <dblack@...> 2007/10/18

Hi --

[#274770] Re: Class instance variable idiom — "ara.t.howard" <ara.t.howard@...> 2007/10/19

[#274646] combinations listing — Michael Linfield <globyy3000@...>

Making an form of an anagram solver. My approach would be the code

20 messages 2007/10/18
[#274706] Re: combinations listing — mortee <mortee.lists@...> 2007/10/18

Others have already shown you how you can generate all permutations of a

[#274769] Re: combinations listing — Peña, Botp <botp@...> 2007/10/19

RnJvbTogbW9ydGVlIFttYWlsdG86bW9ydGVlLmxpc3RzQGthdmVtYWxuYS5odV0gDQojIEhvd2V2

[#274774] Re: combinations listing — Michael Linfield <globyy3000@...> 2007/10/19

Thanks all ----

[#274840] Re: combinations listing — Brian Adkins <lojicdotcom@...> 2007/10/19

On Oct 19, 2:01 am, Michael Linfield <globyy3...@hotmail.com> wrote:

[#274773] the level of Ruby programmers vs PHP's — SpringFlowers AutumnMoon <summercoolness@...>

i asked the same question on Ruby: how do you write some code to print

18 messages 2007/10/19
[#274779] Re: the level of Ruby programmers vs PHP's — Shuaib Zahda <shuaib.zahda@...> 2007/10/19

do you mean something like this

[#274820] Is it always the norm to skip 'return'? — Tito Ciuro <tciuro@...>

Hello,

24 messages 2007/10/19
[#274822] Re: Is it always the norm to skip 'return'? — "Glen Holcomb" <damnbigman@...> 2007/10/19

On 10/19/07, Tito Ciuro <tciuro@mac.com> wrote:

[#274936] Why's (Poignant) Guide to Ruby (is this guy ok?) — "Jayson Williams" <williams.jayson@...>

Recently, I was looking for a Ruby guide that could help my son catch

11 messages 2007/10/20

[#274958] RubyGems Beta 0.9.4.6 — Eric Hodel <drbrain@...7.net>

RubyGems 0.9.4.6 is a beta release for the upcoming 0.9.5 which adds

20 messages 2007/10/20
[#274979] Re: [ANN] RubyGems Beta 0.9.4.6 — Sasa Ebach <se@...> 2007/10/20

Hi Eric,

[#274986] Re: [ANN] RubyGems Beta 0.9.4.6 — Eric Hodel <drbrain@...7.net> 2007/10/20

On Oct 20, 2007, at 09:43 , Sasa Ebach wrote:

[#275007] Re: [ANN] RubyGems Beta 0.9.4.6 — Sasa Ebach <se@...> 2007/10/20

> On Oct 20, 2007, at 09:43 , Sasa Ebach wrote:

[#275025] Is Ruby For Me? — Tony De <tony@...>

Hi all,

25 messages 2007/10/21

[#275037] Problem using FileUtils to sort JPEG files — forgottenwizard <phrexianreaper@...>

This is an odd problem, I admit. I'm currently working on a short script

14 messages 2007/10/21

[#275156] IronRuby...will it be like J++? — Thufir <hawat.thufir@...>

Could it be that Microsoft won't fully implement the language

22 messages 2007/10/22

[#275177] REXML (1.8.6-p110) backwards compatibility problem with rcov — Brian Candler <B.Candler@...>

When I upgraded my Ubuntu 6.06.1 system from its stock ruby-1.8.4 to

10 messages 2007/10/22

[#275190] Conflicts between using respond_to? and extending Ruby — Trans <transfire@...>

Hi--

27 messages 2007/10/22
[#275193] Re: Conflicts between using respond_to? and extending Ruby — "David A. Black" <dblack@...> 2007/10/22

Hi --

[#275250] Re: Conflicts between using respond_to? and extending Ruby — "ara.t.howard" <ara.t.howard@...> 2007/10/22

[#275280] Re: Conflicts between using respond_to? and extending Ruby — "Sean O'Halpin" <sean.ohalpin@...> 2007/10/22

On 10/22/07, ara.t.howard <ara.t.howard@gmail.com> wrote:

[#275282] Re: Conflicts between using respond_to? and extending Ruby — "Sean O'Halpin" <sean.ohalpin@...> 2007/10/22

On 10/22/07, Sean O'Halpin <sean.ohalpin@gmail.com> wrote:

[#275230] Re: IronRuby...will it be like J++? — James Britt <dangerwillrobinsondanger@...>

Check the archives of Ruby-Talk.

41 messages 2007/10/22
[#275359] Re: IronRuby...will it be like J++? — "Todd Benson" <caduceass@...> 2007/10/23

On 10/23/07, Robert Dober <robert.dober@gmail.com> wrote:

[#275312] Ruby Certification Test — John Joyce <dangerwillrobinsondanger@...>

In the Japanese page of Ruby Association, at http://www.ruby-assn.org/

24 messages 2007/10/23

[#275324] pop/push, shift/unshift — "Simon Schuster" <significants@...>

the inconsistency in naming bothers me. :P I would imagine that it

51 messages 2007/10/23
[#275338] Re: pop/push, shift/unshift — Robert Klemme <shortcutter@...> 2007/10/23

On 23.10.2007 05:53, Simon Schuster wrote:

[#275354] Re: pop/push, shift/unshift — "Simon Schuster" <significants@...> 2007/10/23

*yawn* oh, what? people have been using these terms for a long time?

[#275360] Re: pop/push, shift/unshift — "richard.j.dale@..." <richard.j.dale@...> 2007/10/23

On Oct 23, 10:50 am, "Simon Schuster" <significa...@gmail.com> wrote:

[#275396] Re: pop/push, shift/unshift — "Jes俍 Gabriel y Gal疣" <jgabrielygalan@...> 2007/10/23

On 10/23/07, richard.j.dale@gmail.com <richard.j.dale@gmail.com> wrote:

[#275400] Re: pop/push, shift/unshift — "David A. Black" <dblack@...> 2007/10/23

Hi --

[#275326] recursive array — "Simon Schuster" <significants@...>

207:0> a = [1,2,3,4]

12 messages 2007/10/23

[#275378] to_yaml and international characters — h3raLd <h3rald@...>

Hello,

15 messages 2007/10/23
[#275383] Re: to_yaml and international characters — "Luis Parravicini" <lparravi@...> 2007/10/23

On 10/23/07, h3raLd <h3rald@gmail.com> wrote:

[#275644] Ruby is simple? NooooT! — Casimir P <pikselNOSPAMMi@...>

Hehe whoever said that ruby is not verbose was WRONG!! ;)

16 messages 2007/10/24

[#275697] .each do |foo, bar| what does bar do? — Thufir <hawat.thufir@...>

"code_words.each do |real, code|

27 messages 2007/10/24
[#276096] Re: .each do |foo, bar| what does bar do? — Thufir <hawat.thufir@...> 2007/10/27

On Thu, 25 Oct 2007 06:14:12 +0900, Ben Giddings wrote:

[#276097] Re: .each do |foo, bar| what does bar do? — "David A. Black" <dblack@...> 2007/10/27

Hi --

[#276149] Re: .each do |foo, bar| what does bar do? — Brian Adkins <lojicdotcom@...> 2007/10/27

On Oct 27, 7:05 am, "David A. Black" <dbl...@rubypal.com> wrote:

[#276162] Re: .each do |foo, bar| what does bar do? — 7stud -- <bbxx789_05ss@...> 2007/10/27

Brian Adkins wrote:

[#275742] Intervals in Ruby — Steven D'Aprano <steve@...>

Howdy,

24 messages 2007/10/25

[#275839] Change a string to an integer, report an error if the string does not represent an integer? — Randy Kramer <rhkramer@...>

Can anybody point me to a way to check if a string represents a valid integer

14 messages 2007/10/25

[#275853] Need help understanding metaclassing — Chris Czub <chris.czub@...>

I've been reading lots of Ruby tutorials trying to figure out

17 messages 2007/10/25

[#275866] Ruby Changes in Leopard — "Laurent Sansonetti" <laurent.sansonetti@...>

Hi,

41 messages 2007/10/25
[#276143] Re: [ANN] Ruby Changes in Leopard — Bil Kleb <Bil.Kleb@...> 2007/10/27

John Joyce wrote:

[#276150] Re: Ruby Changes in Leopard — Brian Adkins <lojicdotcom@...> 2007/10/27

On Oct 27, 2:21 pm, Bil Kleb <Bil.K...@NASA.gov> wrote:

[#276154] Re: Ruby Changes in Leopard — James Edward Gray II <james@...> 2007/10/27

On Oct 27, 2007, at 2:15 PM, Brian Adkins wrote:

[#276161] Re: Ruby Changes in Leopard — "David A. Black" <dblack@...> 2007/10/27

Hi --

[#276172] Re: Ruby Changes in Leopard — "Pat Maddox" <pergesu@...> 2007/10/27

Are there any compelling reasons to use the built-in install? I was

[#275888] What's in YOUR Ruby??? Could Ruby ever be a g.p. dev language? — CodeToad <TheOldCodeToad@...>

Hi Folks,

11 messages 2007/10/25

[#275891] cant seem to get system() & pipe to work together — "dtown22@..." <dtown22@...>

I am trying to run a command line utility which converts a wma file to

11 messages 2007/10/25

[#275911] Skip the first invocation e.g. skip_first { foo } — Brian Adkins <lojicdotcom@...>

Consider the following code:

31 messages 2007/10/25

[#275968] Editing Text (#145) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

34 messages 2007/10/26

[#276035] Newlines included in bracket negation — "Chris Morris" <the.chrismo@...>

(... that subject probably makes no sense ...)

12 messages 2007/10/26

[#276085] open-uri + OpenSSL — Matthew Lagace <matthewlagace@...>

Hello,

13 messages 2007/10/27

[#276137] Checkers library — "Helder Ribeiro" <helder@...>

Does anyone know if there's a sort of library for the game Checkers in

14 messages 2007/10/27

[#276179] A memcached-like server in Ruby - feasible? — Tom Machinski <tom.machinski@...>

Hi group,

27 messages 2007/10/27
[#276216] Re: A memcached-like server in Ruby - feasible? — "ara.t.howard" <ara.t.howard@...> 2007/10/28

[#276185] convert string format — Junkone <junkone1@...>

Hello

18 messages 2007/10/27

[#276228] Talking more about JRuby — Charles Oliver Nutter <charles.nutter@...>

For the most part, we've been pretty good about keeping JRuby

30 messages 2007/10/28

[#276231] JRuby disabling ObjectSpace: what implications? — Charles Oliver Nutter <charles.nutter@...>

As some of you may have heard, we're considering disabling

26 messages 2007/10/28
[#276235] Re: JRuby disabling ObjectSpace: what implications? — Charles Oliver Nutter <charles.nutter@...> 2007/10/28

ara.t.howard wrote:

[#276262] Re: JRuby disabling ObjectSpace: what implications? — Robert Klemme <shortcutter@...> 2007/10/28

On 28.10.2007 08:06, Charles Oliver Nutter wrote:

[#276288] Re: JRuby disabling ObjectSpace: what implications? — Charles Oliver Nutter <charles.nutter@...> 2007/10/28

Robert Klemme wrote:

[#276259] Duplicate elements in array — Shuaib Zahda <shuaib.zahda@...>

Hello

15 messages 2007/10/28
[#276263] Re: Duplicate elements in array — "Sean O'Halpin" <sean.ohalpin@...> 2007/10/28

On 10/28/07, Shuaib Zahda <shuaib.zahda@gmail.com> wrote:

[#276334] Enhancing the Gateway (Help Needed) — James Edward Gray II <james@...>

Here's the short-story on the current situation with our mailing list =20=

23 messages 2007/10/28

[#276422] HTML parser Hpricot? and how to get all text — SpringFlowers AutumnMoon <summercoolness@...>

Would a good HTML parser be Hpricot? I wonder if anyone knows an easy

13 messages 2007/10/29

[#276500] Problem with socket.recv() — "Frank Preiswerk" <frank.preiswerk@...>

Hi everyone,

13 messages 2007/10/29

[#276502] find the closest items in an array to a given value. — trebor777 <mrobert@...777.net>

16 messages 2007/10/29

[#276539] Zip an existing directory? — Peter Marks <petertmarks@...>

Hello,

18 messages 2007/10/29
[#276544] Re: Zip an existing directory? — "Phlip" <phlip2005@...> 2007/10/30

> I am trying to zip an existing directory using the following code:

[#276546] Re: Zip an existing directory? — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/30

Phlip wrote:

[#276550] Re: Zip an existing directory? — Peter Marks <petertmarks@...> 2007/10/30

Thanks for the help guys. I am developing in osx and will deploy in

[#276587] Re: Zip an existing directory? — "M. Edward (Ed) Borasky" <znmeb@...> 2007/10/30

Peter Marks wrote:

[#276547] Gateway Upgraded — James Edward Gray II <james@...>

We are now running on my new gateway code that will hopefully get

27 messages 2007/10/30

[#276618] the result of Ruby official logo contest — Yukihiro Matsumoto <matz@...>

Hello All,

81 messages 2007/10/30
[#276621] Re: [ANN] the result of Ruby official logo contest — Yukihiro Matsumoto <matz@...> 2007/10/30

Hi,

[#276643] Re: [ANN] the result of Ruby official logo contest — Peter Szinek <peter@...> 2007/10/30

Robert Dober wrote:

[#276711] Re: [ANN] the result of Ruby official logo contest — James Britt <james.britt@...> 2007/10/30

Peter Szinek wrote:

[#276746] Re: [ANN] the result of Ruby official logo contest — "Martin DeMello" <martindemello@...> 2007/10/30

On 10/30/07, James Britt <james.britt@gmail.com> wrote:

[#276799] Re: [ANN] the result of Ruby official logo contest — "Jeremy McAnally" <jeremymcanally@...> 2007/10/30

You can see my comments on the http://www.rubyinside.com/ page, and I

[#276808] Re: [ANN] the result of Ruby official logo contest — Yukihiro Matsumoto <matz@...> 2007/10/30

Hi,

[#277215] Re: the result of Ruby official logo contest — Willem Källman <lefteus@...> 2007/11/02

Yukihiro Matsumoto wrote:

[#277288] Re: the result of Ruby official logo contest — Chad Perrin <perrin@...> 2007/11/02

On Fri, Nov 02, 2007 at 06:07:21PM +0900, Willem K??llman wrote:

[#276682] InstantRails windows Installation, problem with Gem — Ronald Dsouza <rondsouza2000@...>

Hi Good Morning,

15 messages 2007/10/30

[#276686] Array and ASCII Help needed... — "Hiato Xaero" <hiato3@...>

Hello there,

13 messages 2007/10/30

[#276710] RUBY DRY to replace 6 lines in 1 — Josselin <josselin@...>

I have a group of lines (used in Googlemaps display) based on 2 arrays :

17 messages 2007/10/30

[#276767] Bounty: $250 - Successfully log in to AOL Webmail with Mechanize — "dave.myron@..." <dave.myron@...>

We're about to release a gem called Blackbook that will automate

12 messages 2007/10/30

[#276801] Why, oh, why, little regexp? — Daniel Waite <rabbitblue@...>

'cost * tax'.match(/([a-z]+)*/).to_a

15 messages 2007/10/30

[#276831] Rubyconf Attendees — "Rick DeNatale" <rick.denatale@...>

Just wondering how many other regulars of ruby-talk will be in

26 messages 2007/10/31

[#276918] Dinner / drink recommendations for Charlotte? — Francis Hwang <francisphwang@...>

With RubyConf 2007 almost upon us, do any Charlotte natives care to

12 messages 2007/10/31

[#276978] Sorting a string... — Daniel Waite <rabbitblue@...>

I was porting a small Python script over to Ruby and realized Ruby does

15 messages 2007/10/31

[SUMMARY] Reverse the Polarity (#143)

From: Ruby Quiz <james@...>
Date: 2007-10-18 21:26:59 UTC
List: ruby-talk #274746
I was glad to see this problem submitted.  I worked on it a ways back when I was
translating examples from Higher-Order Perl.  It shows up in the book during the
discussion of infinite streams.

Watching others solve it was great fun because I realized that Ruby Quiz fans
are crazy.  A couple of you implemented an almost scary amount of the regular
expression syntax.

Probably the craziest solution comes from Jes炭s who even shoehorned in
backreferences.  Let's take a look at parts of that lengthy solution below.

First, some limitations:

	# Number of times to repeat for Star and Plus repeaters
	TIMES = 2
	
	# Set of chars for Dot and negated [^] char groups
	#CHARS = [("a".."z").to_a, ("A".."Z").to_a, ".", ",", ";"].flatten
	CHARS = %w{a b c d e}
	
	# ...

Many regular expressions can match an infinite number of Strings.  Consider the
trivial expression /a+/.  It matches "a", "aa", "aaa", etc.  There are two ways
to handle this practically:  limit the repetition or provide an infinite series
of matches user code can explore and stop as needed.  Jes炭s did the former.

These variables control how much repetition is done and what character set is
used for constructs that match any character or any character not included in a
listed subset.

If your are curious to see the infinite streams approach, I wrote about it as
part of this blog post:

	http://blog.grayproductions.net/articles/infinite_streams

That solution doesn't include the regular expression parsing code though.

Getting back to Jes炭s's code, the next section defines several classes in the
categories of repeaters and groups.  Groups are pieces of a matched String that
can be generated and repeaters control how many times those groups appear. 
Let's begin with a trivial repeater that doesn't really repeat:

	# ...
	
	class OneTimeRepeater
	  def initialize(group)
	    @group = group
	  end
	
	  def result
	    @group.result
	  end
	end
	
	# ...

As, you can see, this repeater just wraps some group.  The result() of this
repeater is the result of that group, one time.  Obviously this is used for
things that don't repeat.

The next repeater should be plenty familiar to regular expression fans though:

	# ...
	
	class StarRepeater
	  def initialize(group)
	    @group = group
	  end
	
	  def result
	    r = []
	    group_res = @group.result
	    group_res.unshift("")
	    TIMES.times do
	      r << group_res
	    end
	    combine(r).uniq
	  end
	end
	
	# ...

This would be the repeater used to handle expressions like /a*/.  The result of
this repeater is zero or more occurrences of the group it was passed. 
Practically speaking here that means between one and TIMES copies of the group
or the empty String to represent zero.  We see this collected into an Array here
and passed on to combine() for generation.

The PlusRepeater, QuestionMarkRepeater and RangeRepeater classes are constructed
similarly.  In the interests of space and time, I'm not going to show those
here.

Now we are ready for the groups.  Again we begin with the trivial cases:

	# ...
	
	class SingleChar
	  def initialize(c)
	    @c = c
	  end
	  def result
	    [@c]
	  end
	end
	
	# ...
	
	class Dot
	  def result
	    CHARS
	  end
	end
	
	# ...

Here we see groups that echo a character and represent a special range of
characters as their results.  Obviously the first is used for literal chunks of
an expression, like /a/, and the second is used for the special regular
expression character /./.

Let's examine the group used to represent alternations like /a|b/:

	# ...
	
	class OrGroup
	  def initialize(first_groupset, second_groupset)
	    @first = first_groupset
	    @second = second_groupset
	  end
	
	  def result
	    strings = @first.map {|x| x.result}
	    s = combine(strings)
	    strings = @second.map {|x| x.result}
	    s.concat(combine(strings))
	  end
	end
	
	# ...

Since the result()s of a group are just the possible generations of that group,
alternation can be represented as the left choices plus the right choices. 
That's what we see here.

Jes炭s's code includes other groups:  CharGroup for character classes,
MultiGroup for nesting groups and managing reference counts, and BackReference
for supporting the regular expression feature of the same name.  I'm going to
skip over these too, to keep the size of this summary reasonable.

Now let's have a look at the combine() method I've glossed over twice now:

	# ...
	
	# Combines arrays, concatenating each string
	# merging the possible groups they have
	# Starts combining the first two arrays, then goes on
	# combining each other array to the result of the
	# previous combination
	def combine(arrays)
	 string = arrays.inject do |r, rep|
	   temp = []
	   r.each {|aa| rep.each {|bb| temp << (aa.concat_and_merge_groups(bb))}}
	   temp
	 end
	 string
	end
	
	class String
	  attr_accessor :filled_groups
	
	  def add_filled_group(num, group)
	    @filled_groups ||= {}
	    @filled_groups[num] = group
	  end
	
	  def concat_and_merge_groups(other)
	    temp = self + other
	    groups = {}
	    groups.merge!(self.filled_groups) if self.filled_groups
	    groups.merge!(other.filled_groups) if other.filled_groups
	    temp.filled_groups = groups
	    temp
	  end
	
	end
	
	# ...

The combine() method just turns an Array of group result()s into the actual
combinations of Strings.  So given [%w[a b], %w[c d]] it outputs %w[ac ad bc
bd].

The String additions here that are tracking groups were added to support
backreferences.  This was a challenging feature to support and it required
hooking into the code at many levels.  I don't want to focus on it too much
though since it wasn't a critical part of the quiz so much as an impressive
extra Jes炭s managed to include.

The next method we need to look at is the parser.  I'm going to trim some of it
because it's quite long, but you should still get to see how it's put together:

	# ...
	
	class Regexp
	  attr_reader :num_groups
	  def parse(s, i = 0)
	    repeaters = []
	    group = nil
	    while i < s.length
	      char = s[i].chr
	      case char
	      # ...
	      when '.'
	        group = Dot.new
	      when '|'
	        groups, i = parse(s, i + 1)
	        group = OrGroup.new(repeaters, groups)
	        return [group], i
	      # ...
	      else
	        group = SingleChar.new(char)
	      end
	
	      repeater = nil
	      i += 1
	      if i < s.length
	        case s[i].chr
	        when '*'
	          repeater = StarRepeater.new(group)
	        # ...
	        else
	          repeater = OneTimeRepeater.new(group)
	          i -= 1
	        end
	        i += 1
	      else
	        repeater = OneTimeRepeater.new(group)
	      end
	      repeaters << repeater
	    end
	    return repeaters, i
	  end
	  
	  # ...

As you can see, this is a recursive character by character parser.  It reads
through the expression finding groups and wrapping those in repeaters, with
whatever level of nesting is required.  This builds up an Abstract Syntax Tree
for the expression.

Let's see how this gets put to use to create the quiz solution method:

	  # ...
	  
	  def generate
	    @num_groups = 0
	    r = self.inspect[1..-2]
	    repeaters, _ = self.parse(r)
	    strings = repeaters.map {|x| x.result}
	    s = combine(strings)
	    # Makes a pass for the backreferences
	    s.each do |string|
	      string.gsub!(/__(\d+)__/) do |match|
	        string.filled_groups[$1.to_i]
	      end
	    end
	    s
	  end
	end

The process here is very simple:  pull the source of the expression, parse it
into the AST, generate the result() of the AST, and combine() those Strings into
the needed Array of matches.  Again, the rest of the code here is used to
substitute backreferences back into the end results.

Jes炭s also included another method that pretty-printed and verified results,
but I won't go into that here.

As usual I don't want you to miss out on the other solutions.  James Koppel used
currying to build up an AST of functions.  Vasil Vangelovski sent in a slow but
unique approach that works on all regular expressions without even parsing them.
Do take the time to inspect the solutions.  It's worth it.

My thanks to all who poured so much effort into this quiz.  You are all
fearless.

Tomorrow we will take a stab at slicing up time...

In This Thread

Prev Next