Given the define tree:
(define tree
'("S" (("-" ("A" 3333) ("A" 4444))
("W" (("+" ("R" 0) ("R" 1))
("+" ("R" 1) ("R" 2))
("+" ("R" 2) ("R" 3))
("+" ("R" 3) ("R" 4))
("+" ("R" 4) ("R" 5)))
(("-" ("R" 0) ("R" 1))
("-" ("R" 1) ("R" 2))
("-" ("R" 2) ("R" 3))
("-" ("R" 3) ("R" 4))
("-" ("A" 1000) ("A" 2000)))))))
I am trying to access the values. Doing car
and cdr
works for the first and getting the rest but when I try to get a specific value like ("A" 1000)
I get the error:
cdr: contract violation
expected: pair?
given: '().
I have tried (car (cdr (cdr (cdr '(tree)))))
, (cdddr tree)
but I always get that error. Any helpful tips will be appreciated.