[plt-scheme] structure consist of list.

From: Mona (mona.esmaili at gmail.com)
Date: Mon Nov 23 08:58:03 EST 2009

Hi everybody
I have one question about define struct that consist of list.

(define-struct trading-card (card-number name role))
;trading-card is a structure (make-trading-card c-n n r)
;where c-n is number and n , r are string.

;Example
(define trading-card1(make-trading-card 1 'PEZZE 'FULL))
(define trading-card2(make-trading-card 7 'LANZA 'ASSOCIATE))
(define trading-card3(make-trading-card 16 'POZZI 'ASSISTNT))


(define-struct pack (tradinging-card))
;pack is a structure (make-pack t-c)
;where t-c is a list of trading-card.

(define pack1(make-pack (list trading-card1 trading-card2 trading-
card3)))


I want to say  get the structure of the pack (that consist of the
list) and if trading-card-card-number < 5 return true but I dont know
how to do in SCheme?

(make-pack
 (list
  (make-trading-card 1 'PEZZE 'FULL)
  (make-trading-card 7 'LANZA 'ASSOCIATE)
  (make-trading-card 16 'POZZI 'ASSISTNT)))

Thank you.
Mona


Posted on the users mailing list.