Ruby 2.0

When is Ruby 2.0 due? Or estimated due date?

Where could I find info on this?

Thanks,
Joe

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

···

On Sat, 4 Dec 2004 14:12:40 +0900, Joe Van Dyk <joe.vandyk@boeing.com> wrote:

When is Ruby 2.0 due? Or estimated due date?

Where could I find info on this?

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

> When is Ruby 2.0 due? Or estimated due date?
>
> Where could I find info on this?

As has been hinted at:

(It* will be done -- typo :wink: )

···

On Sat, 4 Dec 2004 02:48:59 -0700, Brian Mitchell <binary42@gmail.com> wrote:

On Sat, 4 Dec 2004 14:12:40 +0900, Joe Van Dyk <joe.vandyk@boeing.com> wrote:
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
---
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}

···

Brian Mitchell <binary42@gmail.com> wrote

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

William James wrote:

···

Brian Mitchell <binary42@gmail.com> wrote

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}

Yet shorter:

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

     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 :frowning:

Hi --

···

On Sun, 5 Dec 2004, Florian Gross wrote:

William James wrote:

> Brian Mitchell <binary42@gmail.com> wrote
>
>>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}

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"}}'

:slight_smile:

David

--
David A. Black
dblack@wobblini.net

What would be "good form" for the sig for production code?

···

On Sun, 5 Dec 2004 08:55:32 +0900, Giovanni Intini <intinig@gmail.com> wrote:

> 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 :frowning:

David A. Black wrote:

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

David A. Black wrote:

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"}}'

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

Giovanni Intini wrote:

    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 :frowning:

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.

worked on mine. OS X 1.8.2 preview 3.

···

On Sun, 5 Dec 2004 13:05:26 +0900, Zach Dennis <zdennis@mktec.com> wrote:

David A. Black wrote:

>
> 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

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... :frowning:

Try,

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

Regards,

Bill

···

From: "Zach Dennis" <zdennis@mktec.com>

~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.

Is this an example of a Sierpinski Triangle?

···

--
Into RFID? www.rfidnewsupdate.com Simple, fast, news.

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 :wink:

ruby -e ....
Brian Mitchell

···

---
T.B.D.

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

···

On Mon, 6 Dec 2004 12:23:06 +0900, Lyndon Samson <lyndon.samson@gmail.com> wrote:

Is this an example of a Sierpinski Triangle?

---
T.B.D.

I can't get this to run on any of my boxes. :wink:

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

···

"Brian Mitchell" <binary42@gmail.com> wrote:

ruby -e ....

> 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.

Stay tuned for a mail client written in or with ruby embedded that
lets you execute your sigs :wink:

···

On Mon, 6 Dec 2004 12:51:01 +0900, Brian Mitchell <binary42@gmail.com> wrote:

On Mon, 6 Dec 2004 12:23:06 +0900, Lyndon Samson > <lyndon.samson@gmail.com> wrote:

irb,

Brian Mitchell
---
T.B.D.

--
Into RFID? www.rfidnewsupdate.com Simple, fast, news.

Could we see it any way?

Thanks,
T.

···

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.