I'm attempting to recursively parse through a list that contains numbers, strings, and null lists and convert any strings to numbers using string->number
(define tnode '(5 "5" () ()))
using the function
(define (test funct inlist)
(cond((null? inlist) '())
((number? inlist) ((cons (car inlist) (test funct (cdr inlist)))))
(else (cons (funct (car inlist)) (test funct (cdr inlist))))
)
)
as
(test string->number tnode)
however I am recieving a contract violation error on the first number 5 (and on the later null lists if I use a tnode with only strings and null lists). It seems as if the function is ignoring the first two conditions and going straight to the else statement. Why is this? I dont believe that there are any syntax errors as other cond functions ive tested have worked fine. I'm not quite sure what the issue is.