[#60304] FreeRIDE hangs when I use gets — sothoth@... (Yog-Sothoth)

Hi there, and happy new year!

23 messages 2003/01/01
[#60305] Ruby DBI — David King Landrith <dave@...> 2003/01/01

Is there any way to retrieve the table and database associated with

[#60306] Re: Ruby DBI — Tom Sawyer <transami@...> 2003/01/01

On Wednesday 01 January 2003 07:03 am, David King Landrith wrote:

[#60309] Re: Ruby DBI — David Landrith <dlandrith@...> 2003/01/01

On Wednesday, January 1, 2003, at 09:20 AM, Tom Sawyer wrote:

[#60378] Interfaces in Ruby — "Robert" <bob.news@...>

15 messages 2003/01/02

[#60541] testunit 0.1.6 problems — Daniel Berger <djberg96@...>

ruby 1.6.7, 1.6.8, 1.7.3

39 messages 2003/01/04
[#60556] Re: testunit 0.1.6 problems — <nathaniel@...> 2003/01/04

Daniel Berger [mailto:djberg96@yahoo.com] wrote:

[#60579] Re: testunit 0.1.6 problems — Gavin Sinclair <gsinclair@...> 2003/01/04

On Sunday, January 5, 2003, 2:46:04 AM, nathaniel wrote:

[#60914] Re: Test::Unit fails w/no tests [was: testunit 0.1.6 problems] — <nathaniel@...> 2003/01/08

Gavin Sinclair [mailto:gsinclair@soyabean.com.au] wrote:

[#60947] Re: Test::Unit fails w/no tests [was: testunit 0.1.6 problems] — Gavin Sinclair <gsinclair@...> 2003/01/09

On Thursday, January 9, 2003, 6:56:44 AM, nathaniel wrote:

[#60959] Re: Test::Unit fails w/no tests [was: testunit 0.1.6 problems] — "Mike Campbell" <michael_s_campbell@...> 2003/01/09

> In my mind, there's nothing whatsoever wrong with an empty unit test.

[#60604] Forward: Drafting a "The Year in Scripting Languages" — matz@... (Yukihiro Matsumoto)

Hello,

21 messages 2003/01/05
[#60652] Re: Forward: Drafting a "The Year in Scripting Languages" — ptkwt@...1.aracnet.com (Phil Tomson) 2003/01/06

I noticed several replies which said that they could not do this - I

[#60620] bad interpreter — Arnaudo Massimo <marnaudo@...>

Hi everibody,

31 messages 2003/01/05
[#60985] Re: bad interpreter — mkcon@... (Martin Kahlert) 2003/01/09

In article <20030105144216.GA2879@gull.zena.it>,

[#61045] Re: bad interpreter — Arnaudo Massimo <marnaudo@...> 2003/01/09

* Martin Kahlert <mkcon@gmx.de> [gioved09 gennaio 2003, alle 16:36]:

[#61046] Re: bad interpreter — dblack@... 2003/01/09

Hi --

[#61052] Re: bad interpreter — Stoyan Zhekov <zhware@...> 2003/01/09

> > masarn1@gull:~/Ruby$ ./test.rb 2> error.log

[#61183] Re: bad interpreter — Arnaudo Massimo <marnaudo@...> 2003/01/11

* Stoyan Zhekov <zhware@hotpop.com> [venerd10 gennaio 2003, alle 08:55]:

[#60636] Compile time constant folding? — Dan Sugalski <dan@...>

Here's a quick question, now that parrot's close to getting object

19 messages 2003/01/05

[#60650] attr_cast, one a small step for interface techniques — Tom Sawyer <transami@...>

another addition to tomslib/rubylib:

16 messages 2003/01/06
[#60657] Re: attr_cast, one a small step for interface techniques — Jim Freeze <jim@...> 2003/01/06

On Monday, 6 January 2003 at 10:30:54 +0900, Tom Sawyer wrote:

[#60665] Re: attr_cast, one a small step for interface techniques — Gavin Sinclair <gsinclair@...> 2003/01/06

On Monday, January 6, 2003, 1:20:06 PM, Jim wrote:

[#60691] Re: attr_cast, one a small step for interface techniques — Tom Sawyer <transami@...> 2003/01/06

On Sunday 05 January 2003 09:30 pm, Gavin Sinclair wrote:

[#60702] Re: attr_cast, one a small step for interface techniques — Gavin Sinclair <gsinclair@...> 2003/01/06

On Monday, January 6, 2003, 7:48:18 PM, Tom wrote:

[#60766] Re: A very humour game — Gavin Sinclair <gsinclair@...>

Should a rule be set up that disallows messages (or attachments) of

13 messages 2003/01/07

[#60786] Re: attachment:ot -was RE: A very humour game — "Pe, Botp" <botp@...>

12 messages 2003/01/07

[#60877] Can you detect if a method takes a block argument? — Martin Hart <martin@...>

Hi all, hope everybody had a great new year - it is snowing outside for

16 messages 2003/01/08

[#60910] Ruby advocacy in sigs — Brennan Leathers <digibren@...>

I've started using the following as a sig on leoville.com, a very large

51 messages 2003/01/08
[#61644] Re: Ruby advocacy in sigs — "Gennady" <gfb@...> 2003/01/15

>

[#61645] Re: Ruby advocacy in sigs — Daniel Carrera <dcarrera@...> 2003/01/15

On Thu, 16 Jan 2003, Gennady wrote:

[#61662] Re: Ruby advocacy in sigs — "Park Heesob" <phasis@...> 2003/01/16

Hi,

[#61664] Re: Ruby advocacy in sigs — dblack@... 2003/01/16

Hi --

[#61667] Re: Ruby advocacy in sigs — "Hal E. Fulton" <hal9000@...> 2003/01/16

----- Original Message -----

[#61678] Re: Ruby advocacy in sigs — Tom Sawyer <transami@...> 2003/01/16

"More powerful than Perl, more object-oriented than Python."

[#61684] Re: Ruby advocacy in sigs — Hugh Sasse Staff Elec Eng <hgs@...> 2003/01/16

On Thu, 16 Jan 2003, Tom Sawyer wrote:

[#60926] The Year in Scripting Languages (Final Draft) — Lyle Johnson <lyle@...>

All,

44 messages 2003/01/08
[#60928] Re: The Year in Scripting Languages (Final Draft) — Tom Sawyer <transami@...> 2003/01/08

so who are we?

[#60943] Rubyists (Re: The Year in Scripting Languages (Final Draft)) — matz@... (Yukihiro Matsumoto) 2003/01/09

Hi,

[#60965] Re: Rubyists (Re: The Year in Scripting Languages (Final Draft)) — Jim Freeze <jim@...> 2003/01/09

On Thursday, 9 January 2003 at 9:18:00 +0900, Yukihiro Matsumoto wrote:

[#60944] OT: apple x11 — Brennan Leathers <digibren@...>

just in case anyone missed the word on the wire, apple has released its

24 messages 2003/01/09

[#61002] @@'s are not inherited? — Tom Sawyer <transami@...>

please correct me if i'm wrong but i beleive i just discovered something i did

12 messages 2003/01/09

[#61098] Using Observer pattern in client/server architecture - how? — Martin Hart <martin@...>

Hi everyone,

10 messages 2003/01/10

[#61144] Why Fox — Daniel Carrera <dcarrera@...>

Could someone explain to me why Ruby is adopting Fox as its standard GUI?

24 messages 2003/01/10

[#61167] 'require' search path — Tim Bates <tim@...>

I wish 'require' would count the current directory as the directory the file

16 messages 2003/01/11

[#61220] Ruby: politics & performance [long] — Louis Krupp <lkrupp@...>

The problem: Read a structured file (the details are irrelevant)

26 messages 2003/01/11

[#61271] sorting with the Swartzian transform — Daniel Carrera <dcarrera@...>

Hello all,

14 messages 2003/01/12

[#61349] OT: IE blatantly defiant of HTML standards — Tom Sawyer <transami@...>

33 messages 2003/01/13
[#62019] Re: OT: IE blatantly defiant of HTML standards — Eric Hodel <drbrain@...7.net> 2003/01/19

Tom Sawyer (transami@transami.net) wrote:

[#62046] Re: OT: IE blatantly defiant of HTML standards — Dmitri Colebatch <dim@...> 2003/01/20

> Tom Sawyer (transami@transami.net) wrote:

[#62048] Re: OT: IE blatantly defiant of HTML standards — Tom Sawyer <transami@...> 2003/01/20

On Sunday 19 January 2003 08:21 pm, Dmitri Colebatch wrote:

[#62049] Re: OT: IE blatantly defiant of HTML standards — Dmitri Colebatch <dim@...> 2003/01/20

Tom Sawyer wrote:

[#62060] Re: persistence (was: IE blatantly defiant of HTML standards) — Anders Bengtsson <ndrsbngtssn@...> 2003/01/20

--- Dmitri Colebatch <dim@colebatch.com> wrote:

[#62122] Re: persistence (was: IE blatantly defiant of HTML standards) — Tom Sawyer <transami@...> 2003/01/21

On Monday 20 January 2003 04:58 am, Anders Bengtsson wrote:

[#61351] UML tool for Linux? — Tim Bates <tim@...>

Does anyone know of a good OO modelling (UML?) tool for Linux, that works well

23 messages 2003/01/13

[#61435] Yet Another Test First Example ... in Ruby — Jim Weirich <jweirich@...>

Our local XP group did a Test-Driven Design clinic. Although most of

13 messages 2003/01/14

[#61497] ruby-dev summary 19198-19345 — Kazuo Saito <ksaito@...>

49 messages 2003/01/14
[#61499] Re: ruby-dev summary 19198-19345 — Paul Brannan <pbrannan@...> 2003/01/14

On Wed, Jan 15, 2003 at 02:31:22AM +0900, Kazuo Saito wrote:

[#61534] Re: ruby-dev summary 19198-19345 — Matt Armstrong <matt@...> 2003/01/14

Paul Brannan <pbrannan@atdesk.com> writes:

[#61565] Re: ruby-dev summary 19198-19345 — matz@... (Yukihiro Matsumoto) 2003/01/15

Hi,

[#61566] Re: ruby-dev summary 19198-19345 — Matt Armstrong <matt@...> 2003/01/15

matz@ruby-lang.org (Yukihiro Matsumoto) writes:

[#61571] Re: ruby-dev summary 19198-19345 — Gavin Sinclair <gsinclair@...> 2003/01/15

On Wednesday, January 15, 2003, 3:17:11 PM, Matt wrote:

[#61574] Re: ruby-dev summary 19198-19345 — matz@... (Yukihiro Matsumoto) 2003/01/15

Hi,

[#61512] Re: ruby-dev summary 19198-19345 — Tom Sawyer <transami@...> 2003/01/14

On Tuesday 14 January 2003 10:31 am, Kazuo Saito wrote:

[#61665] Re: ruby-dev summary 19198-19345 — Tom Sawyer <transami@...> 2003/01/16

On Tuesday 14 January 2003 12:40 pm, Tom Sawyer wrote:

[#61653] Quick question for Japanese speaker — "Hal E. Fulton" <hal9000@...>

I've created a graphic based on the Kanji

12 messages 2003/01/15

[#61682] Re: ruby-dev summary 19198-19345 — "Pe, Botp" <botp@...>

13 messages 2003/01/16

[#61749] Linux Editor — dwerder@... (Dominik Werder)

What's your favorite ruby editor on linux?

22 messages 2003/01/16

[#61757] quick: it responds, it evaluates, and is not empty — Tom Sawyer <transami@...>

quick quest: anyone know of a nice slick short and sweet way to do this:

38 messages 2003/01/17
[#61797] Re: quick: it responds, it evaluates, and is not empty — "Bulat Ziganshin" <bulatz@...> 2003/01/17

Hello Tom,

[#61842] Re: quick: it responds, it evaluates, and is not empty — Tom Sawyer <transami@...> 2003/01/17

On Thursday 16 January 2003 11:25 pm, Bulat Ziganshin wrote:

[#61846] Re: quick: it responds, it evaluates, and is not empty — "Bulat Ziganshin" <bulatz@...> 2003/01/17

Hello Tom,

[#61848] Re: quick: it responds, it evaluates, and is not empty — Tom Sawyer <transami@...> 2003/01/17

On Friday 17 January 2003 07:08 am, Bulat Ziganshin wrote:

[#61854] Re: quick: it responds, it evaluates, and is not empty — Gavin Sinclair <gsinclair@...> 2003/01/17

On Saturday, January 18, 2003, 1:22:09 AM, Tom wrote:

[#61855] Re: quick: it responds, it evaluates, and is not empty — dblack@... 2003/01/17

Hi --

[#61864] Re: quick: it responds, it evaluates, and is not empty — ahoward <ahoward@...> 2003/01/17

On Fri, 17 Jan 2003 dblack@candle.superlink.net wrote:

[#61872] Re: quick: it responds, it evaluates, and is not empty — dblack@... 2003/01/17

Hi --

[#61896] Re: quick: it responds, it evaluates, and is not empty — ahoward <ahoward@...> 2003/01/17

On Sat, 18 Jan 2003 dblack@candle.superlink.net wrote:

[#61759] most popular unix scripting language — dorli@... (dambalaMaster)

does anyone know which is the most popular unix scripting language?

26 messages 2003/01/17

[#61810] Automating Perl -> Ruby translation? — "Hal E. Fulton" <hal9000@...>

Has anyone given any thought to this

22 messages 2003/01/17
[#61875] Re: Automating Perl -> Ruby translation? — ptkwt@...1.aracnet.com (Phil Tomson) 2003/01/17

In article <034a01c2be07$95670380$0300a8c0@austin.rr.com>,

[#61901] Resolution to CGI API problem? — Travis Whitton <whitton@...>

There is a very long thread [ruby-talk:39898] that talks about changes

11 messages 2003/01/17

[#61965] PickAxe index? — Daniel Carrera <dcarrera@...>

Does PickAxe online have an index?

14 messages 2003/01/18

[#62063] a single class that supports multiple facets/interfaces — David Garamond <davegaramond@...>

i want to have a class that can support multiple sets of methods, based

16 messages 2003/01/20
[#62090] Re: a single class that supports multiple facets/interfaces — dblack@... 2003/01/20

Hi --

[#62268] extend (Re: a single class that supports multiple facets/interfaces) — David Garamond <davegaramond@...> 2003/01/22

dblack@candle.superlink.net wrote:

[#62093] Local variable scope — Daniel Carrera <dcarrera@...>

I'm a bit confused by the scope of local variables.

24 messages 2003/01/20

[#62203] accessors for module instance vars — ptkwt@...1.aracnet.com (Phil Tomson)

I've got a module that that has several classes defined within it. These

17 messages 2003/01/21
[#62250] Re: accessors for module instance vars — ptkwt@...1.aracnet.com (Phil Tomson) 2003/01/22

In article <Pine.LNX.4.33.0301212020500.6373-100000@eli.fsl.noaa.gov>,

[#62213] Newbie Q: do i need PStore for this or something else ? — "Vandemoortele Simon" <delirious_nospamplz@...>

_Background info:_

17 messages 2003/01/21

[#62319] Re: exit status, stderr and stdout — "Berger, Daniel" <djberge@...>

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

14 messages 2003/01/22

[#62321] Definition: iterator — Daniel Carrera <dcarrera@...>

I sort of know what an iterator is, but not well enough to explain it.

18 messages 2003/01/22

[#62340] mod_ruby: what's persistent and what's shared? — Tom Sawyer <transami@...>

i'm tired of being confused about this and i'm hoping someone can clear this

21 messages 2003/01/23

[#62344] Can we attack the 'not enough libraries' thing straight on? — dblack@...

Hi --

136 messages 2003/01/23
[#62349] Re: Can we attack the 'not enough libraries' thing straight on? — Simon Cozens <simon@...> 2003/01/23

dblack@candle.superlink.net writes:

[#62358] Re: Can we attack the 'not enough libraries' thing straight on? — dblack@... 2003/01/23

Hi --

[#62645] Re: Can we attack the 'not enough libraries' thing straight on? — "MikkelFJ" <mikkelfj-anti-spam@...> 2003/01/25

[#62648] Re: Can we attack the 'not enough libraries' thing straight on? — ahoward <ahoward@...> 2003/01/25

On Sat, 25 Jan 2003, MikkelFJ wrote:

[#62658] Re: Can we attack the 'not enough libraries' thing straight on? — Mark Wilson <mwilson13@...> 2003/01/25

The following is my initial, and not yet complete, proposal on

[#62696] Re: Can we attack the 'not enough libraries' thing straight on? — "Iain 'Spoon' Truskett" <spoon@...> 2003/01/26

* Mark Wilson (mwilson13@cox.net) [26 Jan 2003 09:44]:

[#62699] Re: Can we attack the 'not enough libraries' thing straight on? — Mark Wilson <mwilson13@...> 2003/01/26

[#62705] Re: Can we attack the 'not enough libraries' thing straight on? — "Iain 'Spoon' Truskett" <spoon@...> 2003/01/26

* Mark Wilson (mwilson13@cox.net) [26 Jan 2003 17:26]:

[#62725] Re: Can we attack the 'not enough libraries' thing straight on? — Dave Thomas <dave@...> 2003/01/26

Iain 'Spoon' Truskett wrote:

[#62731] Re: Can we attack the 'not enough libraries' thing straight on? — "Mike Campbell" <michael_s_campbell@...> 2003/01/26

[#62738] Re: Can we attack the 'not enough libraries' thing straight on? — Dave Thomas <dave@...> 2003/01/26

Mike Campbell wrote:

[#62750] Re: Can we attack the 'not enough libraries' thing straight on? — Daniel Carrera <dcarrera@...> 2003/01/26

I certainly think that RAA should have a search feature.

[#62808] Re: Can we attack the 'not enough libraries' thing straight on? — "NAKAMURA, Hiroshi" <nahi@...> 2003/01/27

Hi, all,

[#62733] Re: Can we attack the 'not enough libraries' thing straight on? — ahoward <ahoward@...> 2003/01/26

On Sun, 26 Jan 2003, Dave Thomas wrote:

[#62369] Re: Can we attack the 'not enough libraries' thing straight on? — Simon Cozens <simon@...> 2003/01/23

Daniel Carrera <dcarrera@math.umd.edu> writes:

[#62373] Re: Can we attack the 'not enough libraries' thing straight on? — dblack@... 2003/01/23

Hi --

[#62381] Re: Can we attack the 'not enough libraries' thing straight on? — Tom Sawyer <transami@...> 2003/01/23

want to here a crazy idea?

[#62545] Re: Can we attack the 'not enough libraries' thing straight on? — Warren Brian Noronha <warren@...> 2003/01/24

dear devels

[#62345] Hash#+ ? — Daniel Carrera <dcarrera@...>

I think that there should be a Hash#+ method, aking to Array#+.

22 messages 2003/01/23
[#62347] Re: Hash#+ ? — dblack@... 2003/01/23

Hi --

[#62350] Re: Hash#+ ? — Tom Sawyer <transami@...> 2003/01/23

On Wednesday 22 January 2003 06:52 pm, dblack@candle.superlink.net wrote:

[#62351] Re: Hash#+ ? — Daniel Carrera <dcarrera@...> 2003/01/23

On Thu, Jan 23, 2003 at 11:14:08AM +0900, Tom Sawyer wrote:

[#62376] Re: Hash#+ ? — Tom Sawyer <transami@...> 2003/01/23

On Wednesday 22 January 2003 07:20 pm, Daniel Carrera wrote:

[#62378] Re: Hash#+ ? — matz@... (Yukihiro Matsumoto) 2003/01/23

Hi,

[#62383] Missing libraries?? — "Hal E. Fulton" <hal9000@...>

I'm starting a new thread to get away from

22 messages 2003/01/23

[#62665] RAA proposal — Daniel Carrera <dcarrera@...>

Hello all,

20 messages 2003/01/26
[#62667] Re: RAA proposal — Jim Freeze <jim@...> 2003/01/26

On Sunday, 26 January 2003 at 10:48:02 +0900, Daniel Carrera wrote:

[#62669] Re: RAA proposal — Daniel Carrera <dcarrera@...> 2003/01/26

On Sun, Jan 26, 2003 at 10:57:28AM +0900, Jim Freeze wrote:

[#62708] solaris porting problem -- flock failure? — Joel VanderWerf <vjoel@...>

Any solaris gurus out there?

27 messages 2003/01/26

[#62730] cascading configuration variables — Wilbert Berendsen <wilbert@...>

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

13 messages 2003/01/26

[#62767] common regular expressions — Michael Garriss <mgarriss@...>

Sorry if this a stupid question but I am new to ruby AND regular

17 messages 2003/01/26

[#62836] Test::Unit -> order of tests? — Mauricio Fern疣dez <batsman.geo@...>

28 messages 2003/01/27
[#62845] Re: Test::Unit -> order of tests? — Michael Garriss <mgarriss@...> 2003/01/27

IMHO, it would be nice if they were run in the order they were defined.

[#62852] Re: Test::Unit -> order of tests? — ahoward <ahoward@...> 2003/01/27

On Tue, 28 Jan 2003, Michael Garriss wrote:

[#62855] Re: Test::Unit -> order of tests? — Chad Fowler <chad@...> 2003/01/27

[#62861] Re: Test::Unit -> order of tests? — ahoward <ahoward@...> 2003/01/27

On Tue, 28 Jan 2003, Chad Fowler wrote:

[#62867] Re: Test::Unit -> order of tests? — Matt Armstrong <matt@...> 2003/01/27

ahoward <ahoward@fsl.noaa.gov> writes:

[#62899] Re: Test::Unit -> order of tests? — "Warren Brown" <wkb@...> 2003/01/28

> To implement this, I would suggest renaming all your test_XXX methods

[#62847] tkgnuplot problem: fork() on win — Ralf <lausianne@...>

Hi,

17 messages 2003/01/27
[#62936] Re: tkgnuplot problem: fork() on win (popen3 for windows?) — ptkwt@...1.aracnet.com (Phil Tomson) 2003/01/28

In article <20030128122113W.nagai@ai.kyutech.ac.jp>,

[#62890] ruby-dev summary 19380-19436 — TAKAHASHI Masayoshi <maki@...>

Hello all,

14 messages 2003/01/27

[#63065] Local variables & blocks — ahoward <ahoward@...>

108 messages 2003/01/29
[#63072] Re: Local variables & blocks — Gavin Sinclair <gsinclair@...> 2003/01/29

On Wednesday, January 29, 2003, 5:04:51 PM, ahoward wrote:

[#63075] Re: Local variables & blocks — Gavin Sinclair <gsinclair@...> 2003/01/29

On Wednesday, January 29, 2003, 6:17:44 PM, Gavin wrote:

[#63087] Re: Local variables & blocks — Mauricio Fern疣dez <batsman.geo@...> 2003/01/29

On Wed, Jan 29, 2003 at 04:40:21PM +0900, Gavin Sinclair wrote:

[#63100] Re: Local variables & blocks — matz@... (Yukihiro Matsumoto) 2003/01/29

Hi,

[#63103] Re: Local variables & blocks — ahoward <ahoward@...> 2003/01/29

On Thu, 30 Jan 2003, Yukihiro Matsumoto wrote:

[#63119] Re: Local variables & blocks — matz@... (Yukihiro Matsumoto) 2003/01/29

Hi,

[#63203] Re: Local variables & blocks — Martin DeMello <martindemello@...> 2003/01/30

ahoward <ahoward@fsl.noaa.gov> wrote:

[#63211] Re: Local variables & blocks — ahoward <ahoward@...> 2003/01/30

On Thu, 30 Jan 2003, Martin DeMello wrote:

[#63558] Re: Local variables & blocks — "Robert Klemme" <bob.news@...> 2003/02/03

[#63560] Re: Local variables & blocks — matz@... (Yukihiro Matsumoto) 2003/02/03

Hi,

[#63094] Ruby Books -- A Question — Mark Probert <probertm@..._acm.org>

Rubyists,

15 messages 2003/01/29

[#63198] reading past a file header — Martin DeMello <martindemello@...>

Looking for a more idiomatic way to do this:

12 messages 2003/01/30

[#63216] Newbie question — n.vasiliev@... (Nicolay Vasiliev)

Hello!

17 messages 2003/01/30

[#63284] Return values from assertions — <nathaniel@...>

Eivind Eklund and I have been discussing whether assertions ought to

12 messages 2003/01/31

[#63305] %L, %l revisited — Tom Sawyer <transami@...>

this is a general request for opinion/support. i, for one, would very much

40 messages 2003/01/31
[#63556] Re: %L, %l revisited — nobu.nokada@... 2003/02/03

Hi,

[#63566] Re: %L, %l revisited — Tom Sawyer <transami@...> 2003/02/03

On Monday 03 February 2003 01:26 am, nobu.nokada@softhome.net wrote:

[#63592] Re: %L, %l revisited — nobu.nokada@... 2003/02/03

Hi,

[#63773] Re: %L, %l revisited — Tom Sawyer <transami@...> 2003/02/05

Nobu,

[#63777] Re: %L, %l revisited — dblack@... 2003/02/05

Hi --

[#63784] Re: %L, %l revisited — "Hal E. Fulton" <hal9000@...> 2003/02/05

----- Original Message -----

[#63799] Re: %L, %l revisited — Tom Sawyer <transami@...> 2003/02/05

On Wednesday 05 February 2003 02:44 pm, Hal E. Fulton wrote:

Re: Feature request: Array.to_h

From: dblack@...
Date: 2003-01-20 15:06:49 UTC
List: ruby-talk #62080
Hi --

On Mon, 20 Jan 2003, Tom Payne wrote:

> dblack@candle.superlink.net wrote in message news:<Pine.LNX.4.44.0301181254230.23130-100000@candle.superlink.net>...
> > Almost :-)  See <http://www.ruby-talk.org/6663>.  I seem to evade
> > naming any of the variants just "to_h" (they're to_h_raw, to_h_ikeys),
> > etc.  I'm inclined to think "to_h" would be what I called "to_h_raw",
> > i.e.:  [1,2,3,4].to_h => { 1 => 2, 3 => 4 }, but I'm not sure.
>
> I think of Arrays as mapping integers >= 0 to values, and of Hashes of
> mapping arbitrary keys to values. So, for me, the POLS for Array.to_h
> would be to produce a Hash that maps the same keys as the array to the
> same values, i.e [:a, :b].to_h => {0 => :a, 1 => b}.
>
> Your to_h ([1,2,3,4].to_h => { 1 => 2, 3 => 4 }) might be more
> familiar to a PERL programmer. IIRC, in PERL hashes can be written
> [key0, value0, key1, value1, ...], but I might be wrong.

(s/PERL/Perl/ :-)  Yes, there's something like that in Perl, but I'm
thinking more about what's familiar to a Ruby programmer:

  Hash[1,2,3,4]  # => { 1 => 2, 3 => 4 }

and taking that as the model for the simplest case of creating a hash
from a list (literal or array-derived).  It's possible to argue that,
since we already have the above, we don't need Array#to_h to emulate
it.  I suppose I like the sort of organic quality of a to_h that does
what Hash[*arr] does, and then variants that build on that simplest
construct.

I don't think POLS is a big issue here.  Since there are several
versions of this in circulation already, whoever uses them pretty much
has to be willing to read the code and/or documentation anyway :-)

> N.B. Your implementation of to_h_raw from
> <http://www.ruby-talk.org/6663>:
> should really be in the Array class, not the Enumerable module,
> because it uses the shift method: Arrays have this, but Enumerables
> don't.

Whoops.  Glitches from 60000 messages ago come back to haunt
me.... :-)

> An implementation using each (provided by Enumerable):
>
> module Enumerable
>   def to_h_raw(default = nil)
>     result = Hash.new(default)
>     key = nil
>     index = 0
>     each do |element|
>       case index % 2
>       when 0 then key = element
>       when 1 then result[key] = element
>       end
>       index += 1
>     end
>     result[key] = nil if index % 2 == 1
>     result
>   end
> end
>
> [1, 2, 3, 4].to_h_raw => {1=>2, 3=>4}
> [1, 2, 3, 4, 5].to_h_raw => {5=>nil, 1=>2, 3=>4}

You can trim this down a bit.  Accessing an uninitialized array
element will give you nil, so you don't have to test for that.  Here's
a version on the very-short-and-probably-inefficient end of the scale
-- there's probably a nice middle ground somewhere :-)

  module Enumerable
    def to_h_raw(default=nil)
      Hash[*(if (size % 2).zero? then to_a else to_a + [default] end)]
    end
  end

  p [1, 2, 3, 4].to_h_raw     # => {1=>2, 3=>4}
  p [1, 2, 3, 4, 5].to_h_raw  # => {5=>nil, 1=>2, 3=>4}

  h = [1,2,3].to_h_raw(10)
  p h[3]                      # => 10


David

-- 
David Alan Black
home: dblack@candle.superlink.net
work: blackdav@shu.edu
Web:  http://pirate.shu.edu/~blackdav


In This Thread

Prev Next