I need to take a number from a list and convert it to a number so that i can pass it as a parameter.
im trying to make a 1-bit adder in scheme. i've written the code for the or gate and the xor gate and also the half adder and now im trying to combine them all to make a full adder. im not sure if im going about it the right way. any input will be appreciated thank you.
(define or-gate
(lambda (a b)
(if (= a 1)
1
(if (= b 1)
1
0))))
(define xor-gate
(lambda (a b)
(if (= a b)
0
1)))
(define ha
(lambda (a b)
(list (xor-gate a b)(and-gate a b))))
(define fa
(lambda (a b cin)
(or-gate (cdr(ha cin (car (ha a b))))(cdr(ha a b)))))
the issue i get when i run the program is that the half adder (ha) function outputs a list as a value and that makes the values incompatible with my other procedures because they require numbers and not lists. i feel like there is a simple solution but i dont know it.