Corrections site for:

Ruby for Medicine and Biology Cover

  1. On page page 7, top line, at the beginning of the line, there should be a linebreak after C:\ftp\rb>irb

  2. On page 109, the sentence.rb script sends output to the monitor. It should send the output to an external file. The third to last line of the script is:
    print(line + "\n")
    
    It will send output to an external file if it is re-written as:
    fout.print(line + "\n")
    
    Thanks goes to R. Mark Sharp, Ph.D., who found the error and suggested the fix, on December 21, 2009.

  3. The bigsort.pl script on page 150 of Ruby Programming for Medicine and Biology, has a few quirks. First, it assumes that the text file (to be sorted) is a DOS-style file with a two character (carriage-return,line-feed) linebreak. Also, it assumes that every line (in the file to be sorted) contains alphanumeric text.

    This slightly modified Ruby script will work in any type of text file and does not require text to appear on any lines of the file.
    #!/usr/local/bin/ruby
    text = File.open("terms.txt", "r")
    out = File.open("terms.put", "w")
    linearray = Array.new
    begin_position = 0
    text.each_line do
        |line|
        old_position = begin_position
        begin_position = text.pos
        line = line.chomp! + "          "
        linearray << line.slice(0..9) + old_position.to_s
    end
    linearray.sort!
    linearray.each do
      |value|
      seekplace = value.slice(10..20).to_i
      text.seek(seekplace, IO::SEEK_SET)
      out.puts(text.readline)
    end
    exit
    
    Thanks goes to Dr. Tim Rand, who spotted the error and sent me his own version of a fix on February 6, 2008.

  4. On page 288, In the List title, the intended word is MEANINFUL, not MEANINGUL.

  5. On page 290, in the middle of the third paragraph, the word nil shoud appear entirely in Courier font.


  • Contact the author by email.

    Books by Jules J. Berman, covers

    Last modified: December 22, 2009