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

Recommended Answers

All 3 Replies

I dont know if it is usefull the a peice of the code
(define (count-digit x)
(cond
[(zero? x) x]
[else
(+ (count-digit (remainder (abs x) 10)) 1)

]))

It may help to solve my prblem coz it count the number of digits.Then i stuck to proceed

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

how r u getting the output
iam not getting it
elaborate it a more

As this thread is more than two years old, I don't think the OP is too interested in the answer anymore...
:X

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.