Hello every,
I have a problem in scheme programming.
I am begneer in scheme programming.I use Drscheme tool.
my problem I want to write a program that spell in integer numbers without using (list or map) just a normal function that checks the parameter of the function if it a boollen it will return a boolean if itis a symbol it will return sam symbol but if it is integer number it will return
the english form.I spent a rround 8 hours to figure out how to number part .
this my code

(define (spell x)
(cond
((symbol? x) x)
((boolean? x) x)
; if it is number
(else 'Failed)))
================
output example for numbers
(spell 456)='four 'five ' six
=================

this an extra code that me help to solve my problem
(define (count-digit x)
(cond
[(zero? x) x]
[else
(+ (count-digit (remainder (abs x) 10)) 1)

]))

You don't know how to do it? What have you thought?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.