Don't wrap your arguments in parentheses - (abs(x)) means "call the procedure x and pass the result to abs.
(cons (first(y)second(y)) means "cons these four things: the value of first; the result of calling the procedure y; the value of second; and the result of calling the procedure y".
(You've called procedures correctly in some places. Stick to the same pattern.)
You're also missing a comparison in a couple of conditions; (= (modulo (abs x) 1000) 0).
The inputs are not lists, they're integers, so you can't apply length, first, or any such things to them.
The result should be an integer, not a list, so you can't construct it using append and cons, you should only use arithmetic.
These facts about integers should get you started:
- A number has fewer than five digits if it is smaller than 10000.
- The last four digits of a non-negative number
nis(modulo n 10000). - If
xis 12 andyis 34,x * 100 + yis 1234. - To get the three leftmost digit in an integer, you can divide by 10 repeatedly until you have a number less than 1000.
Also note that the second number only has one condition on its digits while the first has two, and that the note about defining auxiliary functions was not left there as a challenge for you to do without them.
For instance, if you had the auxiliary functions
(left-digits n x), which produces the leftmostndigits ofx, and(right-digits n x), which produces the rightmostndigits ofx
you could write (it's also probably not a coincidence that the description uses the words "if" and "or"):
(define (make5 x y) (if (or ( ... )) -2 (+ (* 100 (right-digits 3 x)) (left-digits 2 y)))) Since you want to ignore the sign of the numbers, it's convenient to take care of abs once at the start, using let:
(define (make5 signed-x signed-y) (let ((x (abs signed-x)) (y (abs signed-y))) (if (or ( ... )) -2 (+ (* 100 (right-digits 3 x)) (left-digits 2 y))))) "All" that's left now is filling in the conditions and writing the two digit-extracting functions.