Rick DeNatale schrieb:
> On 5/13/07, darren kirby <bulliver / badcomputer.org> wrote:
>> quoth the Martin DeMello:
>>
>> > What would be a nice approach is a tour of the fundamental
>> > data structures, each one accompanied by an algorithm that it forms
>> > the core of, and a full implementation in ruby.
>>
>> He does include code in Ruby, though oddly, it is not presented 
>> inline, nor
>> even linked inline:
>>
>> http://www.brpreiss.com/books/opus8/programs/index.html
>
> Not the best examples of ruby code though.
>
> For example this:
> http://www.brpreiss.com/books/opus8/programs/pgm02_01.txt
>
> Would be done idiomatically in Ruby as
>
>   (1..n).inject {|sum, e| sum + e)
>
> And this
> http://www.brpreiss.com/books/opus8/programs/pgm02_04.txt
>
> by just
>
>   a.max
>
> A random sampling of the code looks like it's mostly C-code
> transliterated into Ruby.
I have stumbled over this book some years ago and read a few pages to 
figure out if it was worth reading. I encountered a sentence that 
contained something like "ruby virtual machine creates an object". This 
was before Ruby 1.9. included YARV and when YARV didn't yet exist (or 
was in its early infancy like all the other VM implementations back 
then), and the author didn't mention which virtual machine he meant at 
all. I figured he didn't know that Ruby was an AST interpreter and just 
made shit up. I decided not to invest more time in reading the book, 
because if the author cannot be bothered to research some basic facts 
about Ruby and instead spreads untruth about it, what quality will the 
rest of the book have?

Your transliteration theory reminded me of that, so I searched for "ruby 
virtual machine creates an object" on google:

http://www.google.com/search?hl=en&safe=off&q=site%3Abrpreiss.com+%22ruby+virtual+machine+creates+an+object%22&btnG=Search

Result was:
"Garbage Collection and the Other Kind of Heap
When the Ruby virtual machine creates an object, it performs the 
following steps:. An unused region of memory large enough to hold an 
instance of the ...
www.brpreiss.com/books/opus8/html/page414.html - 6k - Cached - Similar 
pages"

Now, I changed "ruby" to "python":

http://www.google.com/search?hl=en&safe=off&q=site%3Abrpreiss.com+%22python+virtual+machine+creates+an+object%22&btnG=Search

Result was:
"Garbage Collection and the Other Kind of Heap
When the Python virtual machine creates an object, it performs the 
following steps:. An unused region of memory large enough to hold an 
instance of the ...
www.brpreiss.com/books/opus7/html/page415.html - 7k - Cached - Similar 
pages"

What a surprise! Writing books doesn't seem to be so difficult after all.

-- 
Florian Frank