16 May 00:00
Re: The Turing Machine (#162)
From: Alpha Chen <alpha.chen <at> gmail.com>
Subject: Re: The Turing Machine (#162)
Newsgroups: gmane.comp.lang.ruby.general
Date: 2008-05-15 22:00:07 GMT
Subject: Re: The Turing Machine (#162)
Newsgroups: gmane.comp.lang.ruby.general
Date: 2008-05-15 22:00:07 GMT
Thanks for the writeup!
But a small nitpick... =)
On May 15, 11:26 am, Matthew Moss <matthew.m...@gmail.com> wrote:
> puts @tape.sort.map {|_,v| v}.join.gsub(/^_*|_*$/, '')
>
> "useful" content of the tape is displayed. Chen's regular expression
> (slightly corrected in the code shown above), removes all blanks
> immediately after the start of the line _or_ immediately preceding the
> end of the line.
Shouldn't the regex return "a" instead of "a_b" for "_a_b_"?
RSS Feed