File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7070 system-type ;; hard-coded
7171 not findf
7272 read-line
73+ * ; limited
7374 exact->inexact / expt string->keyword ; unimplemented
7475 ;; Op0
7576 read-byte peek-byte void
Original file line number Diff line number Diff line change 1313 not
1414 findf
1515 read-line
16+ * ; limited
1617 char-alphabetic? char-whitespace?
1718 displayln ; only works for strings
1819 write-string
9293(define (procedure? x) (%procedure? x))
9394(define (eq-hash-code x) (%eq-hash-code x))
9495
96+ (define (* x y)
97+ (match x
98+ [0 0 ]
99+ [1 y]
100+ [2 (arithmetic-shift y 1 )]
101+ [4 (arithmetic-shift y 2 )]
102+ [8 (arithmetic-shift y 3 )]
103+ [10 ; 10a=2^3a+2a
104+ (+ (arithmetic-shift y 1 )
105+ (arithmetic-shift y 3 ))]
106+ [16 (arithmetic-shift y 4 )]
107+ [64 (arithmetic-shift y 6 )]
108+ [_ (error "unimplemented multiplication " )]))
109+
110+
95111;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
96112;; Op2
97113(define (+ . xs)
Original file line number Diff line number Diff line change 668668 #f )
669669 (check-equal? (run '(apply string-append (list "x " )))
670670 "x " )
671- )
671+
672+ (check-equal? (run '(* 0 8 )) 0 )
673+ (check-equal? (run '(* 1 8 )) 8 )
674+ (check-equal? (run '(* 2 9 )) 18 )
675+ (check-equal? (run '(* 2 -3 )) -6 )
676+ (check-equal? (run '(* 4 3 )) 12 )
677+ (check-equal? (run '(* 8 3 )) 24 )
678+ (check-equal? (run '(* 16 2 )) 32 )
679+ (check-equal? (run '(* 10 5 )) 50 )
680+ (check-equal? (run '(* 64 2 )) 128 ))
672681
673682
674683(define (test-runner-io run)
You can’t perform that action at this time.
0 commit comments