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 ;; examp

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

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

2017-09-07 Thread 'John Clements' via Racket Users
> On Sep 7, 2017, at 9:28 AM, jaroslaw.mo...@gmail.com wrote: > > > 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 (div