Getting the median of 3 values using scheme's car & cdr
Posted
by kristian Roger
on Stack Overflow
See other posts from Stack Overflow
or by kristian Roger
Published on 2010-04-30T23:10:37Z
Indexed on
2010/04/30
23:37 UTC
Read the original article
Hit count: 264
Scheme
The problem this time is to get the median of three values (easy)
I did this:
(define (med x y z) (car(cdr(x y z)))
and it was accepted but when testing it:
(med 3 4 5)
I get this error:
Error: attempt to call a non-procedure
(2 3 4)
And when entering letters instead of number i get:
(md x y z)
Error: undefined varia
y
(package user)
Using something besides x y z I get:
(md d l m)
Error: undefined variable
d
(package user)
the question was deleted dont know how anyway
write a function that return the median of 3 values
© Stack Overflow or respective owner