schemerackethtdp

Accessing a list inside struct in Racket


I have a structure as:

(define-struct abc (item-list x y))

I want to access elements of item-list which is a list iteratively. How do I achieve this in racket?

I tried:

(abc-item-list a)

but doesn't work.

Note: I am using Intermediate Student Language for the same.


Solution

  • It works for me:

    #lang htdp/isl ;https://stackoverflow.com/questions/18303242/selecting-student-language-in-racket-source-code
    
    (define-struct abc (item-list x y))
    (define test (make-abc (list 1 2) 4 5))
    (abc-item-list test)
    ; ==> (list 1 2)