Ruby 2.0

J

Joe Van Dyk

When is Ruby 2.0 due? Or estimated due date?

Where could I find info on this?

Thanks,
Joe
 
B

Brian Mitchell

When is Ruby 2.0 due? Or estimated due date?

Where could I find info on this?

As has been hinted at:
I will be done as soon as someone makes it. A number of projects are
on their way to that. YARV being one of them. I don't know if 1.9 will
ever become stable 2.0 in this case. It seems to just be a proving
ground for features.

This is all my speculation. Anyone else have any hard facts or plans?

Brian Mitchell
 
B

Brian Mitchell

As has been hinted at: (It* will be done -- typo ;) )
I will be done as soon as someone makes it. A number of projects are
on their way to that. YARV being one of them. I don't know if 1.9 will
ever become stable 2.0 in this case. It seems to just be a proving
ground for features.

This is all my speculation. Anyone else have any hard facts or plans?

Brian Mitchell
 
W

William James

Brian Mitchell said:
32.times{|y|print" "*(31-y);(y+1).times{|x|print" #{~y&x==0?"A":"."}"};puts}


Excellent signature, Brian. Here's a shortened version:

32.times{|y|print" "*(31-y);(y+1).times{|x|print~y&x>0?" .":" A"};puts}
 
F

Florian Gross

William said:
Excellent signature, Brian. Here's a shortened version:

32.times{|y|print" "*(31-y);(y+1).times{|x|print~y&x>0?" .":" A"};puts}

Yet shorter:

32.times{|y|print" "*(31-y),(0..y).map{|x|~y&x>0?" .":" A"},$/}
 
G

Giovanni Intini

32.times{|y|print" "*(31-y),(0..y).map{|x|~y&x>0?" .":" A"},$/}

This really is wonderful, but the most wonderful thing its that I
cannot understand it intuitively :(
 
D

David A. Black

Hi --

Yet shorter:

32.times{|y|print" "*(31-y),(0..y).map{|x|~y&x>0?" .":" A"},$/}

Does this count as shorter?

ruby -le'32.times{|y|print" "*(31-y),(0..y).map{|x|~y&x>0?" .":" A"}}'

:)


David
 
Z

Zach Dennis

David said:
Does this count as shorter?

ruby -le'32.times{|y|print" "*(31-y),(0..y).map{|x|~y&x>0?" .":" A"}}'

This doesn't run on my system....

C:\source\projects\wxruby\src>ruby -le '32.times{|y|print"
"*(31-y),(0..y).map{|x|~y&x>0?" .":" A"}}'
'y' is not recognized as an internal or external command,
operable program or batch file.

Zach
 
N

Nicholas Van Weerdenburg

worked on mine. OS X 1.8.2 preview 3.

This doesn't run on my system....

C:\source\projects\wxruby\src>ruby -le '32.times{|y|print"
"*(31-y),(0..y).map{|x|~y&x>0?" .":" A"}}'
'y' is not recognized as an internal or external command,
operable program or batch file.

Zach
 
B

Bill Kelly

From: "Zach Dennis said:
This doesn't run on my system....

C:\source\projects\wxruby\src>ruby -le '32.times{|y|print"
"*(31-y),(0..y).map{|x|~y&x>0?" .":" A"}}'
'y' is not recognized as an internal or external command,
operable program or batch file.

DOS is too dumb to understand single quotes... :(

Try,

ruby -le"32.times{|y|print' '*(31-y),(0..y).map{|x|~y&x>0?' .':' A'}}"


Regards,

Bill
 
B

Brian Mitchell

To finally reply to all who imporved upon my sig:

Yes. I could have made it shorter but I liked the simplicity of my
fisrt and current one. Its easy to understand.... I may get sick of it
and use a short version but at that point I will be probably coming up
with something new ;)

ruby -e ....
Brian Mitchell
 
D

Dave Burt

Brian Mitchell said:
ruby -e ....

I can't get this to run on any of my boxes. ;)

Seriously, thanks for all that, guys, I've never watched a round of Ruby
Golf before now. Far more interesting than that game with the silly little
white ball.

Cheers,
Dave
 
F

Florian Gross

David said:
Does this count as shorter?

ruby -le'32.times{|y|print" "*(31-y),(0..y).map{|x|~y&x>0?" .":" A"}}'

Nice, not sure if this is officially shorter, but it is something I did
certainly not know nor think off. Thanks for mentioning it.
 
F

Florian Gross

Giovanni said:
This really is wonderful, but the most wonderful thing its that I
cannot understand it intuitively :(

32.times{|y|...}: We are going to output 32 lines and we'll need to know
the line number as we iterate over each of them.

print" "*(31-y), ...: Print 31 - current line number spaces. This will
print 31 spaces for the first line and 0 for the last one. This is
needed for centering the pyramid segment. Try removing it and it will be
stuck to the left border of the screen.

(0..y).map{|x|...}: produce y+1 segments. We will produce one for the
first line and 32 ones for the last line. The pyramid will be wider at
the bottom.

~y&x>0?" .":" A": The heart of the algorithm. Let's explain it by sample.

y: 000000
~y: 111111
x: 000000
~y&x: 000000
=> " A"

The segment for the first line is [" A"]

y: 000001
~y: 111110
x: 000000
~y&x: 000000
=> " A"
y: 000001
~y: 111110
x: 000001
~y&x: 000000
=> " A"

The segment for the second line is [" A"," A"]

y: 000010
~y: 111101
x: 000000
~y&x: 000000
=> " A"
y: 000010
~y: 111101
x: 000001
~y&x: 000001
=> " ."
y: 000010
~y: 111101
x: 000010
~y&x: 000000
=> " A"

The segment for the third line is [" A"," ."," A"]

The segment for the fourth line is boringly just [" A"," A"," A"," A"]

y: 000100
~y: 111011
x: 000000
~y&x: 000000
=> " A"
y: 000100
~y: 111011
x: 000001
~y&x: 000001
=> " ."
y: 000100
~y: 111011
x: 000010
~y&x: 000010
=> " ."
y: 000100
~y: 111011
x: 000011
~y&x: 000011
=> " ."
y: 000100
~y: 111011
x: 000100
~y&x: 000000
=> " A"

The segment for the fifth line is [" A"," ."," ."," ."," A"]

At this point we already have this:

A
A A
A . A
A A A A
A . . . A

You can already make out the top of the pyramid. The rest works out just
as well.

I still have to explain how the segments get printed however:

print...,(0..y).map{...}: When print gets an argument that is not
already a String it calls .to_s on it -- Array#to_s is the same as
Array#join without an argument -- it just chains the items together
without a separator.

print...,$/: $/ is the output record separator. It is just a shorter way
of saying "\n". Note that puts could not have been used instead of print
because it also inserts a newline between all its arguments. That would
not work here.

Hope this helped at understanding it post-intuitively. The hardest to
understand is the algorithm it uses.
 
G

Giovanni Intini

~y&x>0?" .":" A": The heart of the algorithm. Let's explain it by sample.

Thank you for the wonderful explanation. This was the most difficult
part to understand.
 
B

Brian Mitchell

Is this an example of a Sierpinski Triangle?
Yes.

I am working on finding more cool one liners that are short enough for a sig.

I came up with a cellular automata simulator but the input and rule
set took up too much space. So I will have to find something else....
if not I will be sticking to my triangle signature. It is always fun
to try and push the limits of a language by doing things like this.

irb,
Brian Mitchell
 
L

Lyndon Samson

Yes.

I am working on finding more cool one liners that are short enough for a sig.

I came up with a cellular automata simulator but the input and rule
set took up too much space. So I will have to find something else....
if not I will be sticking to my triangle signature. It is always fun
to try and push the limits of a language by doing things like this.

Stay tuned for a mail client written in or with ruby embedded that
lets you execute your sigs ;-)
 
T

trans. (T. Onoma)

On Sunday 05 December 2004 10:51 pm, Brian Mitchell wrote:
| I came up with a cellular automata simulator but the input and rule
| set took up too much space.

Could we see it any way?

Thanks,
T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,787
Messages
2,569,631
Members
45,338
Latest member
41Pearline46

Latest Threads

Top