Mae向きなブログ

Mae向きな情報発信を続けていきたいと思います。

9.リストはどのように実装されているか

flowers に violet と buttercup をセットしなさい。また、このリストに更に二つの花を consし、新しく出来たリストを more-flowers にセットしなさい。flowers の CAR に魚の名前をセットしなさい。この時、more-flowers のリストの中身はどうなるか。

(setq flowers '(violet buttercup))
 => (violet buttercup)

(setq more-flowers (cons 'sunflower (cons 'tulip flowers)))
 => (sunflower tulip violet buttercup)

(setcar flowers 'tuna)
 => tuna

flowers
 => (tuna buttercup)

more-flowers
 => (sunflower tulip tuna buttercup)