xicocana
xicocana

Reputation: 125

Accessing a nested structure slot

I have the following structures:

(defstruct track 
    size 
    env 
    startpos 
    endpositions)

(defstruct state 
    pos 
    vel
    action
    cost
    track
    other)

I have a state and Im trying to access endpositions(list of lists)

(setq coluna_final (nth 1 (nth 0 (state-track-endpositions st))))

but I get the error: EVAL: undefined function STATE-TRACK-ENDPOSITIONS

What am I doing wrong?

Upvotes: 0

Views: 124

Answers (1)

sds
sds

Reputation: 60064

The first defstruct defines (inter alia) function track-endpositions, and the second defines state-track. Lisp has no way to know that the latter returns a track (even if you declare the slot type, it will not define the function you want).

You can do it yourself:

(defun state-track-endpositions (st)
  (track-endpositions (state-track st)))

Upvotes: 2

Related Questions