18092-18667

17890-18784 subjects 18289-19573

99 bottles of beer
18092 [mdavis@se ai] a = ' bottle%s of beer'
18094 [waisun.chia@] OMG! ;-)
18095 [aleksei.guze] # OMG! ;-)
18101 [grady@xc .b ] (I believe in Perl circles this is called Golf.  This is the first
+ 18111 [dblack@ca dl] I wonder what gem cutters call it when they achieve their goal using
+ 18113 [tammo.freese] down, pass
+ 18114 [Dave@Pr gm t] Fore!
+ 18134 [pete@vi ya p] {'s'if n!=1}
| 18193 [thucdat@ho m] ...
| + 18204 [glen@en bl d] 99.downto(0){|x|w=" on the wall";u="#{x!=0?eval(x.to_s):'no more'}
| | + 18205 [matt@li ke .] By one...change x!=0 to x>0
| | | + 18206 [glen@en bl d] Unfortunately, that would give grammatically incorrect English on the
| | | + 18207 [siigron@si .] #{u+w} instead of #{u}#{w} should work, no?
| | + 18208 [avi@be a4 co] I don't think this one quite works - you don't decrement the bottle count
| | | + 18210 [dblack@ca dl] (Hmmm... not sure why it's wrapping weirdly.  Anyway...)
| | | | 18212 [avi@be a4 co] ":s " is 3 bytes, as is "'s'", but that's a good one to remember.  And it
| | | | 18217 [dblack@ca dl] Well, at least I was right about the space after puts :-)  It's all
| | | + 18211 [avi@be a4 co] def b
| | | + 18213 [kero@d4 50 u] [165, by my count?]
| | | + 18227 [dblack@ca dl] OK, let's see if I can squeeze some bytes without breaking it this
| | |   18228 [dblack@ca dl] P.S. I know there have been shorter, but I'm being a purist about
| | + 18209 [dblack@ca dl] One could debate the acceptability of the "\n"'s.  But it's not
| | | 18214 [glen@en bl d] Doh! That's what I get for preferring bourbon to beer... I forgot how
| | | 18215 [will.sobel@B] def b
| | | + 18216 [will.sobel@B] Here's another variant without the warnings weighing in at 160 bytes.
| | | + 18218 [avi@be a4 co] def b
| | |   18219 [avi@be a4 co] def b
| | |   18224 [dblack@ca dl] If the space after       ^   can go, then so can ^.  But should either?
| | |   18225 [avi@be a4 co] def b
| | |   18226 [avi@be a4 co] def b
| | |   18229 [avi@be a4 co] Ok.  151 bytes.  No warnings.
| | |   18230 [avi@be a4 co] Make that 149 by removing the parens around n=99.
| | |   18231 [dblack@ca dl] What happened to ' more' ?
| | |   18232 [avi@be a4 co] According to Kero, it wasn't in the original post.  But it shouldn't be
| | |   + 18233 [avi@be a4 co] 145.  Are we sick of this yet?
| | |   | 18234 [dblack@ca dl] Bytes are dropping like flies -- what's not to like? :-)
| | |   + 18237 [jjenning@st ] hehe, Kero's right. I stuck it in within the first few posts on the thread :)
| | + 18258 [erik@ba fo s] Yes, You don't need the eval and you say both "bottle" and "bottles".
| + 18267 [mikkelj-anti] Why does the following not produce any beer?
|   18268 [dblack@ca dl] See yesterday's posts about this version and its derivatives.  It
|   18271 [mikkelj-anti] Actually it doesn't save anything compared to downto, but more
|   18278 [Binky@Ha an ] Hehe
+ 18488 [pete@vi ya p] {'s'if n!=1}
  18667 [westner@lo i] Has anybody submitted one already?

Exceptions
18098 [aleksei.guze] What about "retry"ing from the line where exception occurred and/or just
18099 [matz@ru y- a] It's not what "retry" is for.  There's vague possiblity for
18102 [aleksei.guze] #
+ 18103 [matz@ru y- a] No.  It requires deep core rewrite.  Not an easy task at all.
| 18104 [aleksei.guze] #
| 18123 [matt@li ke .] The argument I've heard against resumable exceptions is that they
+ 18121 [pulsar@qk .c] If I understand it correctly, Ruby provides real/complete block closures?

Looking for Ruby programming exercises
18100 [wvucenic@ne ] I've been learning Ruby, mostly with the Pickaxe book, and it's going
+ 18109 [feoh@fo rf z] I must admit I feel/felt the same way.
| + 18115 [ruby@ja es r] What features of Ruby, though, do you think are the ones most likely to be
| | 18122 [feoh@fo rf z] Iterators and blocks I'd have to say was the Ruby concept I had the hardest
| | 18156 [wvucenic@ne ] Thanks for the reply!
| | 18158 [Dave@Pr gm t] Design a discrete event simulation system in Ruby. Make full use of
| | + 18164 [ruby@ja es r] Do you mean like a cellular automata, except
| | | 18168 [Dave@Pr gm t] Have a look at
| | | 18181 [hipster@xs a] John Wiley & Sons Ltd. 1988. It crosses the bridge between analytic
| | | 18183 [mikkelj-anti] game, but it allowed multiple users to connect simultanously via telnet. It
| | + 18166 [ugly-daemon@] Ok could you be a bit more specific? Like what do you mean by discrete event and
| + 18163 [ jimm@io co ] Here are three already implemented in the base Ruby distribution or easily
+ 18141 [sean-ruby-ta] Why not track a real project?  When I was first learning C I
  18155 [wvucenic@ne ] Thanks for the reply/invitation!

Ruby embedding questions.
18108 [olivier@vi e] As far I looked into Ruby's source code, it doesn't seem possible to

exercise in minimalism: diamonds
18112 [dblack@ca dl] For those who enjoy and/or learn from this kind of thing (I do both),

Delphi like properties ?
18116 [llothar@ma l] I want to implement a C extension for a GUI toolkit that supports
+ 18117 [decoux@mo lo] I don't know delphi, but
+ 18118 [aleksei.guze] You really missed methods "prop" and "prop="
+ 18139 [ljohnson@re ] Since you don't have to write the parentheses with a Ruby method invocation,

rbwrap
18119 [s.unsworth@v] ...

Re: An exercise in minimalism
18120 [ugly-daemon@] Here's a first attempt. It weighs in at 66 bytes.
+ 18125 [maverick@cs ] It should be exactly 98 characters.
+ 18126 [dblack@ca dl] You can take out that space, in which case I declare a tie :-)
+ 18127 [tammo.freese] 60 byte :-)
+ 18151 [pete@vi ya p] I almost squeezed out as much from this direction.

Debugging minimalism for newbies (Re:  Re: An exercise in minimalism)
18128 [feoh@fo rf z] I think it can be a really useful exercise in learning a language to study
18172 [decoux@mo lo] You can always ask ruby to know what it do
18175 [matt@li ke .] Where do you get iis?
18177 [decoux@mo lo] Guy Decoux

Who can count change??
18129 [ugly-daemon@] I would like to propose another game of golf only a little bit different. I am
18138 [joe@vp p. et] I think it will take longer than a few seconds unless you have a
18143 [ugly-daemon@] Whoops I didn't think that far ahead :) Dumb me. Perhaps a more reasonable goal
18145 [ugly-daemon@] I would be very interested in hearing about this. Would you be so kind as to
18152 [ jimm@io co ] Does your version include $2 bills or not? (I've added a command line
18165 [ugly-daemon@] Any and all denominations in your favorite currency.

NodeXmlDump
18130 [maki@op n- e] I hacked Dave's nodeDump to output in XML.

Why does this fail?
18131 [thucdat@ho m] ...
18148 [feoh@fo rf z] No closing bracket on the block.

Why does this fail?
18132 [thucdat@ho m] ...

Why does this fail?
18133 [thucdat@ho m] ...

instance variables by name?
18136 [aaron.barnet] i'd like to have a method that operates on an instance variable given its
18140 [jjenning@st ] here ya go
+ 18142 [aaron.barnet] thanks for the reply, i tried it and i get...
| 18144 [aaron.barnet] ah!  'says=' becomes defined when i set it as attr_writer, not exactly what
+ 18149 [neumann@s- i] eval("@#{name}=value") if name =~ /^\w+$/

dRuby - calling methods of DRbObject defined in Object
18137 [neumann@s- i] a = DRbObject.new(nil, there)
18146 [m_seki@mv .b] Hmm,
18153 [neumann@s- i] I thought method_missing is a private method. But it isn't.

Re: instance variables
18147 [jjenning@st ] # -----

Opaque constants? (in C?)
18150 [onge@mc .a l] Is it possible to define opaque constants in ruby similar to true and
18160 [kom@ma l1 ac] You can make an object 'opaque' by defining "inspect" as a
18185 [emilong@mi w] Great, thanks!  BTW, I'm planning on using capitalized constants, but I

Ruby Golf
18154 [spwhite@ch r] I've been enjoying the games of Golf in here, but there's something I'd
+ 18157 [dblack@ca dl] This is why in my first "bottles" version I explicitly stated that I
| 18169 [mdemello@ru ] As in perl, I think the nice point about keystroke golf is that it provides
+ 18180 [luigi.ballab] 100m dash / synchronized swimming / weight lifting ?  :)

Ruby integration with Vim editor?
18159 [ned@bi e- om] I know that Vim 6.0 can be built with a Ruby interpreter installed. Its

Enabling "super"
18161 [aleksei.guze] I really need some docs...
18162 [aleksei.guze] How can one rb_enable_super for "super" singleton method of module?

Enabling "super"
18167 [aleksei.guze] (1)
18170 [decoux@mo lo] def A.v
18171 [aleksei.guze] #     tt_mM = rb_define_module("M");
18173 [decoux@mo lo] They do the same thing, in this case. In a C extension you don't really
18174 [aleksei.guze] #
18176 [decoux@mo lo] Are you sure ?
18178 [aleksei.guze] # -----Original Message-----
18179 [decoux@mo lo] You have not understood.


18182 [murtz@yi an ] ...

Ruby for Macintosh (OS < X)
18184 [peccatte@cl ] I have seen that it exists a version 1.1c9 of Ruby ported on Macintosh
18197 [ljohnson@re ] one
18198 [peccatte@wa ] tlh43lfjftpk26@corp.supernews.com...

Invoking a method from C side
18186 [llothar@ma l] The "method_call" function is declared private. So how can i
18187 [decoux@mo lo] rb_funcall(methodobj, rb_intern("call"), 1, rb_str_new2("foo"));

Newbie. Sinking fast. Please help.
18188 [matt@gr en i] I bought Programming Ruby a number of months back and finally have an opportunity to try out Ruby. However, I can't get it to build. Actually, that's not quite accurate. It builds fine. It won't pass 'make test'.
+ 18189 [decoux@mo lo] This is the line 985 of sample/test.rb
| 18190 [matt@gr en i] $ cat > script_tmp
| 18194 [matt@gr en i] OK. Here I go replying to my own mail. I've gotten this to work from the command line now.
| 18200 [S.Udrea@gs .] built ruby with --prefix=$HOME, maybe this gives rise to problems?!
| 18202 [Dave@Pr gm t] If that's the case, we need to know about it, because they _should_
| 18240 [matt@gr en i] So, what's the recommended course of action for me to take? I've been tinkering and trying to get it to build for about 20 hours now... (That's excluding sleeping time.) I'm no closer than when I started. I'd really like to use ruby for this project, but it's already taken me 10 times longer to try to just build it than it would have to have written this in perl. I was allocating extra time since I don't know ruby yet, but this is ridiculous! ;)
| 18252 [Dave@Pr gm t] OK - the situation is that you have a test that's failing. We don't
| 18264 [matt@gr en i] $ make test
| 18266 [matt@gr en i] OK, tried to compile it on fbsd 4.3 from source (not ports) and it worked fine. So, it's not inherently FreeBSD that has issues. It may even be just this one 3.3 machine.
+ 18195 [neumann@s- i] Ruby is included in FreeBSD's ports collection. Thus, you don't have to build it yourself.
  18196 [matt@gr en i] I'm aware that it's in the ports collection. However, FreeBSD isn't the platform on which I'm most proficient. It just happens to be what the machine I'm on is running. I'm not root, so AFAIK I can't install anything from the ports tree. That's why I'm building by hand. I'm not sure that I'd trust the patches to 1.4.0 (what's in th ports tree on here) applied against 1.6.4. But I'll take a look anyway. Not being familiar with Ruby, I doubt anything in there will jump out at me and say "Look! Apply me and life will be good!"... ;)

Array threadsafe ?
18191 [uwe.matthaeu] A short question. Is 'Array' or 'Hash' threadsafe ?
18192 [hfulton@po -] Short answer: No.

Pattern Matching takes all Resources
18199 [flcl@gm .n t] I'm having some big problems with Pattern Matching of Regex.
+ 18201 [Dave@Pr gm t] You have got one of those Regexps that operate in exponential time
+ 18246 [decoux@mo lo] Like have said Dave Thomas, your regexp is wrong but

Shooting yourself in the foot with Ruby
18203 [jeremy@ch os] Ruby must have the requisite folk heritage before it will be taken

how does hash locate pairs?
18220 [stephen.hill] in methods such as [], []=, fetch, etc. how does Hash locate a key,
+ 18221 [ranx2@ya oo ] You need to have a method (say to_s) in your Class that returns
+ 18223 [avi@be a4 co] Anytime you redefine ==, you need to redefine hash such that if a == b,
  18235 [matz@ru y- a] Hash uses "eql?", so that you need to redefine hash such that if

Ruby/GTK: example needed of Widget written in Ruby
18222 [mrp@cr .c no] i want to write a gtk widget in ruby.  i've tried lots of things like

how to become a Ruby FTP mirror?
18236 [anany@ec .v ] Hey!

Trouble with C extensions
18238 [rtarpine@ho ] I'm new to both Linux (I unfortunately abandoned BeOS) and Ruby, so I
+ 18239 [sean-ruby-ta] Have you read the Extending Ruby chapter Programming Ruby? =20
+ 18241 [waisun.chia@] void Init_testlib()
+ 18254 [rtarpine@ho ] Thanks, that completely fixed it!  Does case matter?  I initially used
  18255 [decoux@mo lo] Yes,

Determining whether a file exists
18242 [harryo@zi wo] Is there a clean way to determine whether a file exists, without having
+ 18243 [dblack@ca dl] FileTest.exists?("filename")
+ 18245 [neumann@s- i] test(?e, name)
  18247 [harryo@zi wo] Aha!   I didn't look closely enough.  I see it now, listed under
  18248 [dblack@ca dl] See also Michael N.'s response.  I'm not sure what criteria one would
  18251 [harryo@zi wo] I read yours before I saw Michael's and I've already changed the code, so

RCR: Transient instance variables
18244 [neumann@s- i] Currently it is very time consuming to leave some instance varibles
18253 [decoux@mo lo] class Transient
18263 [uu9r@rz un -] This works fine, but has one major drawback, that you have to
18286 [decoux@mo lo] Well, it exist a possibility but this make something complex.
18339 [uu9r@rz un -] Yes, please sent it to me. I am exited ;-)

Re: [Foxgui-users][OT] Sample Application Ideas?
18249 [alwagner@tc ] This reply is only marginally related to your post, but I couldn't help but

missing message: xmp patch contribution
18250 [gotoken@no w] Greetings,

Init & "shutdown"
18256 [rtarpine@ho ] I'm trying to write a ruby extension that needs to run a init() function
18261 [gotoken@no w] In ``[ruby-talk:18256] Init & "shutdown"'',

Ruby 1.6.4 Windows Installer V2 Now Available
18257 [andy@to ls e] For those who have been anxiously awaiting a new version
18563 [lucid@us rs ] Oh frabjous day! Halooh, hallay!  Thankyouthankyouthankyou.
18565 [yves.pouplar] It seems that I have missed a few messages :)
18567 [Stephan.Kaem] Happy rubying!

FastCGI for Ruby (an announcement, not a question)
18265 [eli.green@co] Well, thanks muchly to the help and encouragement of Michael Neumann, the Ruby
18308 [web2ed@ya oo] Outstanding job!  I will test this right away.
18355 [eli.green@co] Hrm. Sorry, folks. I have this really bad habit of not posting URL's when I'm

99 bottles of sake
18269 [thucdat@ho m] ...
18270 [glen@en bl d] (jeez, I really *hate* HTML email!)
18288 [matz@ru y- a] Ah, sorry.  I don't drink alcohol at all.  Try something else.
18292 [   xm@w3 .r ] Good ... alcohol is no good ;) Maybe some fruit juice ... cherry+blackberry+apple mix?

Effecient indexing algorithm
18272 [joe@ai bj ct] Does anyone have an efficient indexing algorithm or care to point me in the
18273 [kero@d4 50 u] Tried Rubies hashtable?
18274 [joe@ai bj ct] Thanks, of course not! (hahaha)  This is about as open ended as you can get.
+ 18275 [mdavis@se ai] I am planning to release my version of a btree written in Ruby sometime
| 18276 [mikkelj-anti] the
| 18277 [joe@ai bj ct] Excellent suggestion, thanks.  There is a ubiquity to this solution that I
| 18296 [ned@wh db y.] How does this compare to libdb-ruby, which is a Ruby interface for the
| 18299 [joe@ai bj ct] It was a joke because I asked a silly question.  Or was it?  (hahaha)  It
| 18300 [mdavis@se ai] My btree is written almost completely in Ruby.  I created several small C
| 18301 [joe@ai bj ct] my bad, it wasn't a joke.  sorry thought poking fun at the confused. ;-)
+ 18307 [john.carter@] Hmm. It depends on whether this is a indexing and rapid update /

FIFO TCP socket pooling server
18279 [joe@ai bj ct] Another little code snippet I wanted to grok was a pooling TCP socket

Re-loading a modified class definition
18280 [harryo@zi wo] I was chatting with a friend of mine last night and we were discussing
18281 [harryo@zi wo] Never mind.  I took a guess that there might be a special variable that
+ 18282 [uu9r@rz un -] Try load instead of require!
+ 18287 [harryo@zi wo] Thanks Michael.  That's precisely what I was looking for.  Saves me doing

New Ruby FTP Mirror
18283 [anany@ec .v ] I have just finished setting up a new Ruby FTP Mirror here on

environment variables
18284 [jens@ir -n t] how can I access environment variables?
+ 18285 [barry_shultz] ENV[key]
+ 18305 [sean-ruby-ta] Check out the ENV global variable.  It's not really a hash, but=20
threads.html
top