I couldn’t help myself. So here is 90% of what John proposed in HtDP’s ISL+
language. Exercise for the reader: fix the failing tests.
#lang htdp/isl+
;; long division
;; Trace = [cons N [cons N [Listof [List N N]]]
;; N N -> Trace
;; compute the trace for the division of x and y
;;
Let me support John’s email with a hint:
#lang htdp/isl+
;; long division
;; Number Number -> (cons Number (cons Number [Listof Number]))
;; compute the list of steps needed to divide x by y
;; work thru an example
;; given 5432, 12
;; wanted [list 452 8) ... optional: (list 54 48) (list 63
2 matches
Mail list logo