简体   繁体   中英

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.

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM