Accessing a list inside struct in Racket

349 Views Asked by At

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.

1

There are 1 best solutions below

1
On BEST ANSWER

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)