# Project for Lucas G.

Hi Lucas G., I see you are experienced with DrRacket/Scheme language. I have quite simple code from stackoverflow and I would like to better understand the code. I know almost zero knowledge of Lisp/Racket/Scheme but I need to pass one of my University exams :). I would like to better understand what each command does, how recursions in this code works etc. My idea is that I will send you the code and then we will have probably 1 hour call. We will go through code row by row. What do you think about it?

--------------------------------------------------------------------

code

--------------------------------------------------------------------

(define (n2t n)

(define 1to19 '(one two three four five six seven eight nine ten eleven twelve

thirteen fourteen fifteen sixteen seventeen eighteen nineteen))

(define multof10 '(twenty thirty forty fifty sixty seventy eighty ninety))

(define thousands '(thousand million billion trillion quadrillion quintillion sextillion septillion octillion nonillion decillion undecillion))

(cond

((= n 0) '(zero)) ; zero is a special case since from now on all 0 will be suppressed

((< n 0) (cons 'minus (n2t (- n))))

(else

(let loop ((n n) (units thousands) (res '()))

(cond

; --- below 1000

((= n 0) res)

((< 0 n 20) (cons (list-ref 1to19 (- n 1)) res))

((< n 100) (cons (list-ref multof10 (- (quotient n 10) 2))

(loop (remainder n 10) '() res)))

((< n 1000) (loop (quotient n 100)

'()

(cons 'hundred (loop (remainder n 100) '() res))))

(else

; --- 1000 and above

(let ((q (quotient n 1000))

(res (loop (remainder n 1000) thousands res)))

(if (zero? q)

res

(loop q (cdr units) (cons (car units) res))))))))))

-----------------------------------------------------------------

Best Regards,

Czech Republic

Beceriler: Haskell, Lisp, Python, Robotik, Scheme

İşveren Hakkında:
( 2 değerlendirme ) Prague, Czech Republic

Proje NO: #15770314

## Bu iş için 1 freelancer ortalamada €15 teklif veriyor

Domus123

Hired by the Employer

in %bids___i_period_sub_35% gün içinde15%project_currencyDetails_sign_sub_37% %project_currencyDetails_code_sub_38%
(4 Değerlendirme)
3.1