PasteRack.org
Paste # 93366
2017-04-21 00:05:35

Fork as a new paste.

Paste viewed 71 times.


Embed:

  1. #lang racket
  2.  
  3. (define (symbol stock)
  4. (car stock))
  5.  
  6. (define (price stock)
  7. (car (cdr stock)))
  8.  
  9. (define (shares stock)
  10. (car (cdr (cdr stock))))
  11.  
  12. (define (printValue stock)
  13. (printf “~a : ~a~% (symbol stock) (* (price stock) (shares stock))))
  14.  
  15. (define (value stock)
  16. (* (price stock) (shares stock)))
  17.  
  18. (define appleStock (list “AAPL” 100 5))
  19.  
  20. (stock appleStock)

=>

“AAPL”: undefined;

 cannot reference an identifier before its definition

  in module: 'm

stock: undefined;

 cannot reference an identifier before its definition

  in module: 'm