Re: [racket-users] Long division algorithm in HtDP way

2017-09-07 Thread Matthias Felleisen
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 ;;

Re: [racket-users] Long division algorithm in HtDP way

2017-09-07 Thread Matthias Felleisen
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

[racket-users] Long division algorithm in HtDP way

2017-09-07 Thread jaroslaw . modry
Dear Racketeers! I would like to write the function divide in racket, for performing the long division, which would print the whole computational process, as the elementary school pupils do. For example, the call (divide 5432, 12) should print this: 5432 : 12 = 452 -48 -- 63 -60 --