[#5999] Re: Custom installation (1.6.1) — ts <decoux@...>
>>>>> "D" == David Suarez de Lis <excalibor@demasiado.com> writes:
[#6019] Time.local bug? — hal9000@...
Please tell me this is a bug, not a feature.
[#6028] Ref.: Re: Time.local bug? — David Suarez de Lis <excalibor@...>
Hi,
[#6042] Re: Time.local bug? — ts <decoux@...>
>>>>> "H" == Hugh Sasse Staff Elec Eng <hgs@dmu.ac.uk> writes:
[#6074] Re: Cygwin conflicts — "Conrad Schneiker/Austin/Contr/IBM" <schneik@...>
Conrad Schneiker wrote:
[#6078] Programming Ruby ranking — Aleksi Niemel<aleksi.niemela@...>
Just a small note how the Ruby book sells:
[#6083] ANN: Single step Ruby installation for Windows — Dave Thomas <Dave@...>
[#6092] Re: detect:ifNone: in Ruby — Aleksi Niemel<aleksi.niemela@...>
> I like it. You can also mess around with the built in classes to get
[#6097] Re: detect:ifNone: in Ruby — Aleksi Niemel<aleksi.niemela@...>
matz queries:
[#6102] What would a Ruby browser look like? — Dave Thomas <Dave@...>
[#6106] Re: What would a Ruby browser look like? — "Conrad Schneiker/Austin/Contr/IBM" <schneik@...>
Stephen White writes:
People are already talking about using Tk to do this, or doing it as a WWW
[#6121] More Date/Time inconsistencies — David Suarez de Lis <excalibor@...>
Hi all,
[#6122] Ruby Book, Eng. tl, 6.1 -- aimai ? — Jon Babcock <jon@...>
[#6138] Thoughts on a Ruby browser — hal9000@...
I have to issue a disclaimer first, that I am not a code browser user,
[#6143] Re: What would a Ruby browser look like? — "Conrad Schneiker/Austin/Contr/IBM" <schneik@...>
Matz writes:
[#6149] Ruby hi(gh), and pointer to Jotto program — David Alan Black <dblack@...>
Hello --
David Alan Black <dblack@candle.superlink.net> writes:
[#6181] Minimal but practically useful Ruby browser? — "Conrad Schneiker/Austin/Contr/IBM" <schneik@...>
Hi,
[#6206] Re: marshal.dump again — ts <decoux@...>
>>>>> "H" == Hugh Sasse Staff Elec Eng <hgs@dmu.ac.uk> writes:
[#6220] ruby-lang.org — Dave Thomas <Dave@...>
[#6246] Re: quiz of the week — "Brian F. Feldman" <green@...>
"Brian F. Feldman" <green@FreeBSD.org> wrote:
> In case anyone wants something else to try an example of how fun
[#6288] lchown()/etc. and Unix syscall completeness — "Brian F. Feldman" <green@...>
Ruby as it is now isn't very consistent with the system calls it provides.
[#6316] Q: Sandbox security, SAFE and system — Robert Feldt <feldt@...>
Hi,
[#6346] Re: Another Smalltalk control structure idea — "Conrad Schneiker/Austin/Contr/IBM" <schneik@...>
Matz writes:
On Tue, 14 Nov 2000 15:29:31 +0900, Conrad Schneiker/Austin/Contr/IBM wrote:
[#6363] Re: rescue clause affecting IO loop behavior — ts <decoux@...>
>>>>> "D" == David Alan Black <dblack@candle.superlink.net> writes:
Hello again --
matz@zetabits.com (Yukihiro Matsumoto) writes:
[#6383] 1.6.x documentation. — Hugh Sasse Staff Elec Eng <hgs@...>
On Tue, 14 Nov 2000, Yukihiro Matsumoto wrote:
[#6386] lots of Threads — Hugh Sasse Staff Elec Eng <hgs@...>
If I have an array to be filled with computationally heavy stuff,
Hugh Sasse Staff Elec Eng <hgs@dmu.ac.uk> writes:
On Thu, 16 Nov 2000, Dave Thomas wrote:
On Thu, 16 Nov 2000 19:59:07 +0900, Hugh Sasse Staff Elec Eng wrote:
[#6412] clas << a & Pascal's with <record> do...end — Hugh Sasse Staff Elec Eng <hgs@...>
I was thinking that when a lot of work must be done on an object
[#6417] Where is T_RANGE? — Robert Feldt <feldt@...>
Hi,
[#6444] Ruby tokenizer for Ruby — Charles Hixson <charleshixson@...>
Does anyone know of a Ruby tokenizer for Ruby? In particular, I am bother
[#6461] Is there a FITS_IN_UINT(v)? — Robert Feldt <feldt@...>
Hi,
Robert Feldt <feldt@ce.chalmers.se> writes:
[#6476] %x{...} and ` not working? — Niklas Backlund <d99-nba@...>
Hi,
[#6485] Re: GUI in ruby — "Conrad Schneiker" <schneik@...>
Hi,
[#6491] comp.lang.tcl -- The "Batteries Included" Distribution [LONG] — "Conrad Schneiker" <schneik@...>
Hi,
On Tue, 21 Nov 2000 16:58:30 +0900, Conrad Schneiker wrote:
[#6503] redefining methods in a hierarchy. — Hugh Sasse Staff Elec Eng <hgs@...>
If I have an object which I know to be a subclass of a subclass (at lease)
[#6518] Re: Question about the behavior of write att ributes in blocks — Aleksi Niemel<aleksi.niemela@...>
> Is it at all possible to write an iterator, which allows assignments
Thank you for explanation - the output of "x".inspect() is
"Christoph Rippel" <chr@subdimension.com> writes:
I lifted the following two lines from your (great) book - Page 285
[#6521] Time Trouble — Niklas Backlund <d99-nba@...>
Hi,
[#6523] alias_method and > and < — Hugh Sasse Staff Elec Eng <hgs@...>
The operators > and < don't seem to be in the list of things one cannot
[#6550] Note on docs for Array#reverse! — Robert Feldt <feldt@...>
[#6571] Re: Ruby/C extension build question — Arjen Laarhoven <arjen@...>
Oops:
[#6579] ANN: Ruby/GDChart 0.0.1 available — Arjen Laarhoven <arjen@...>
Hi all,
[#6582] best way to interleaf arrays? — David Alan Black <dblack@...>
Hello --
David Alan Black <dblack@candle.superlink.net> wrote:
David Alan Black <dblack@candle.superlink.net> writes:
David Alan Black <dblack@candle.superlink.net> writes:
On Tue, 28 Nov 2000, Dave Thomas wrote:
[#6597] Question on sort! — Dave Thomas <Dave@...>
matz@zetabits.com (Yukihiro Matsumoto) writes:
Hi,
> The latter can be avoided if one follows the no-bang-method-chain
[#6642] Hash with a key of nil ? — rpmohn@... (Ross Mohn)
While reading data in from a file and populating a hash, I accidentally
[#6646] RE: Array Intersect (&) question — Aleksi Niemel<aleksi.niemela@...>
Ross asked something about widely known and largely ignored language (on
aleksi.niemela@cinnober.com (Aleksi Niemel) wrote in
> >Use a hash. Here's code to do both and more. It assumes that
----- Original Message -----
Hi,
[#6656] printing/accessing arrays and hashes — raja@... (Raja S.)
I'm coming to Ruby with a Python & Common Lisp background.
matz@zetabits.com (Yukihiro Matsumoto) writes:
[#6666] Suggestion for addition to Begin/End syntax — drew@... (Andrew D. McDowell)
Hi all.
[ruby-talk:6514] RE: Question about the behavior of write attribu tes in blocks
I changed the code a little, to make it more illustrative. The revised code
is in the end of the file. Please, forgive me changing the strings a little.
> root.each { |a| a = "try " } # ``data'' is not changed
> root.each { |a| a.replace "succ " } # ``data'' is changed
The difference between these two snippets is just what you commented.
When the associated block gets called
> def each
> yield data
what exactly block variable 'a' starts to refer at. Well, in the first call
to the block your datastructure is like this:
#<Bt:0x40178894
@right=nil,
@left=#<Bt:0x401788a8
@right=nil,
@left=#<Bt:0x401788bc
@right=nil,
@left=nil,
@data="fail 2">,
@data="fail 1">,
@data="root data">
'a' starts to refer the same string as Bt:0x40178894's @data, that is the
bottommost "root data ". Then, in the block we assign
a = "try "
happens the same thing as:
b = "gets"
c = b
c = "fooled"
puts b, c
outputting
gets
fooled
So in this example c starts to point to same string as b, that is object of
class String containing a string "gets". When c is assigned to refer object
"fooled" b continues to refer to "gets". At any point c is not "pointing" to
variable b itself, and can't alter where b refers to.
Then the second case. When this block is called for the same data
> root.each { |a| a.replace "succ " } # ``data'' is changed
block variable 'a' starts to refer the same string "root data". But instead
of reassign 'a' to point some other string, we invoke the object's method
replace and pass the string "succ " to it. So the very same object that
@data was pointing replaces it's contents with different string, so there's
effectively a change in the data structure.
Hopefully this cleared things a bit. Attached is a slightly modified code,
with convenient dumper method.
BTW. I'm sure you noticed there's a big difference between these two
constructs:
Bt.new ( "fail root", Bt.new "fail 1", Bt.new "fail 2")
Bt.new ( "fail root", Bt.new("fail 1"), Bt.new("fail 2"))
In the resulting data structures the first one doesn't have right branch at
all
#<Bt:0x40178894
@right=nil,
@left=#<Bt:0x401788a8
@right=nil,
@left=#<Bt:0x401788bc
@right=nil,
@left=nil,
@data="fail 2">,
@data="fail 1">,
@data="root data">
like root
/ \
fail 1 nil
/ \
fail2 nil
/ \
nil nil
and the second one is well balanced case :).
#<Bt:0x401785d8
@right=#<Bt:0x401785ec
@right=nil,
@left=nil,
@data="fail 2">,
@left=#<Bt:0x40178614
@right=nil,
@left=nil,
@data="fail 1">,
@data="root data">
like root
/ \
fail 1 fail 2
/ \ / \
nil nil nil nil
- Aleksi
#***********************
# A binary tree class
class Bt
def initialize( cont, l = nil, r = nil )
@data=cont
@left=l
@right=r
end
def each
yield data
left.each { |l| yield l }
right.each { |r| yield r }
end
attr_accessor( :left, :right, :data)
end
module Each
def each
end
end
nil.extend(Each)
def dumper(obj)
indent = 0
str = obj.inspect
while str.length > 0
if m = /(#<.+? )|(, (?=@))|(>, )/.match(str)
if m[1]
indent += 1
print $` + $& + "\n" + " " * indent
str = $'
elsif m[2]
print $` + ",\n" + " " * indent
str = $'
elsif m[3]
indent -= 1
print $` + $& + "\n" + " " * indent
str = $'
end
else
indent -= 1
puts " " * indent + str
str = ""
end
end
end
[Bt.new ( "fail root", Bt.new "fail 1", Bt.new "fail 2"),
Bt.new ( "fail root", Bt.new("fail 1"), Bt.new("fail 2"))
].each do |root|
# ``data'' is changed
root.data="root data"
# ``data'' is not changed
root.each { |a| dumper(root); a = "try"; dumper(root); puts; }
root.each { |a| print a, " " }
puts
dumper(root)
puts "Then the real change"
# ``data'' is changed
root.each { |a| dumper(root); a.replace "succ"; dumper(root); puts; }
root.each { |a| print a, " " }
puts
dumper(root)
puts "\n" * 3
end