I'm trying to translate: http://thinkstats.com/survey.py this script.
So here's what I'm translating right now (Python):
"""This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2010 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
import sys
import gzip
import os
class Record(object):
"""Represents a record."""
class Respondent(Record):
"""Represents a respondent."""
class Pregnancy(Record):
"""Represents a pregnancy."""
Scala:
import sys.process._
import java.util.zip.GZIPInputStream
import java.io._
class Record[T](val obj: T)
class Respondent[T](val record: Record[T])
class Pregnancy[T](val record: Record[T])
Question:
Did I do the class Respondent and the class Pregnancy correctly? Is the type annotation correct for these class? Is the logic correct? I've just read up on type parameterization so I'm a bit iffy on this and wanted to see if I'm on the correct path.
Thank you for your time.
Tused for?Record[Int]be a record that holds anInt. I'm pretty sure it makes sense forRecord, but I'm not sure aboutRespondent-- do different kinds of respondents have different kinds of records?