ANSWERS: Quiz 1, CS 257

  1. You have a file bar.stk in your home directory that you'd like to load into scheme (which is already running inside your Emacs). What do you type?
    
    
    C-c C-l ~/foo.stk
    
    or
    
    (load "~/foo.stk")      in *scheme* buffer
    
    
    
    

  2. Sue the high school hacker gets paid $150 for installing Linux on her dad's company's web server, and invests it all in stock in a startup that goes up 17% before she sells. She then earns $72 for helping recover a file from a disk that crashed without any backups. At this point she invests all her money in Microsoft, just in time for the Great Crash of 1997 in which she loses 54% of her investment.

    Write a Scheme expression that calculates how much money Sue ends up with.

    
    
    
    
    (* (- 1 0.54)
       (+ 72
          (* (+ 1 0.17)
             150)))
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

Barak Pearlmutter <bap@cs.unm.edu>