import sys
sys.dont_write_bytecode=True # don't make .pyc files
from about import *

@demo1
def symd():
  resetSeed(1)
  s   = Sym()
  lst = list('to be or not to be')
  # here, we remember all the things we find
  for x in lst:
    s.seen(x)
  print s
  # here, we report what's seen so far
  print ':counts', mostest(s.counts)
  # now, we pull 50 things from that distribution
  sampler = s.sample(50)
  samples = sorted(c for c in sampler)
  print '['+''.join(samples) + ']'

def numd():
  resetSeed(1)
  n = Num()
  for _ in range(100):
    n.seen(rand()**2)
  print n
  sampler = n.sample(50)
  print sampler
  samples = sorted(n for n in sampler)
  print gs(samples)

def numPlusd():
  i,j  = Num(), Num()
  for _ in range(10): i.seen(rand()/100)
  for _ in range(10): j.seen(rand()*100)
  k = i+j
  k.kept.sorted()
  print gs(k.cached())
  print k.median()

if __name__ == '__main__' : 
  eval(cmd('symd()'))
