8. List Լ

 

1. LIST

    (1)

      Ǵ ڿ Ͽ ϳ Ʈ Լ

    (2)

      (LIST  Expression )

    (3)

       (setq a (list 25 1999))

      : !a      (25 1999)

       (setq a (list 1 2 3 4 5 6))

      : !a      (1 2 3 4 5 6)

       (seta a (list "1 2 3 4 5 6"))

      : !a      ("1 2 3 4 5")

       (setq a (list "1" "2" "3" "4" "5"))

      : !a      ("1" "2" "3" "4" "5")

       (setq Num1 5 Num2 10 Num3 15)

       

       (setq Num4 20)

       

       (setq NList (list Num1 Num2 Num3 Num4))

      : !NList  (5 10 15 20)

 

 

2. NTH

    (1)

      List n° ġϰ ִ Ҹ ϴ Լ

      n 0 쿡 ù ° Ҹ ޾Ƶδ.

    (2)

      (NTH n list-name)

    (3)

       (setq a (list 3 4 5 6 7 8 9 10))

       

       (setq b (nth 0 a))

      : !b      3

       (setq b (nth 3 a))

      : !b      6

       (setq b (nth 7 a))

      : !b     10

       (setq b (nth 1 a))

      : !b      4

     

 

3. CAR(Contens of the Address Register)

    (1)

      List ù° Ҹ иϿ ޾Ƶδ.

    (2)

      (CAR (list))

    (3)

       (setq a (list 1 2 3))

       

       (setq b (list a 4 5 6))

      : !b      ((123) 4 5 6)

       (setq c (car b))

      : !c      (123)

       (setq a (list 1 2 3 4 5 6))

       

       (setq b (car a))

      : !b      1

 

 

4. CADR

    (1)

      List Ͽ ° Ҹ иϿ ޾Ƶδ.

    (2)

      (CADR (list))

    (3)

       (setq a (list 1 2 3 4 5 6))

      : !a         (1 2 3 4 5 6)

       (setq b (cadr a))

      : !b         2

       (setq b (list a 7 8 9 10))

      : !b         ((1 2 3 4 5 6) 7 8 9 10)

       (setq c (cadr b))

      : !c         7

 

    (4) list car cadr α׷

       

       (setq xy01 (list 100 100))

       (setq xy03 (list 200 200))

       (setq xy02 (list (car xy01) (cadr xy03)))

       (setq xy04 (list (car xy03) (cadr xy01)))

       

      2 ǥ 4 簢 ǥ .


      Command: !xy01
      (100 100)

      Command: !xy02
      (100 200)

      Command: !xy03
      (200 200)

      Command: !xy04
      (200 100)

        

 

5. CADDR

    (1)

      List Ͽ ° Ҹ иϿ ޾Ƶδ.

    (2)

      (CADDR (list))

    (3)

       (setq a (list 1 2 3 4 5 6))

      : !a         (1 2 3 4 5 6)

       (setq b (caddr a))

      : !b         3

       (setq b (list 7 8 a))

      : !b         (7 8 (1 2 3 4 5 6))

       (setq c (caddr b))

      : !c         (1 2 3 4 5 6)

 **

 ǥ ǥ Xǥ CAR Լ, Yǥ CADR Լ, Zǥ CADDR Լ ִ.

 

 

6. CDR (Contents of the Decrement Register)

    (1)

      List ° Ҹ ޾Ƶδ.

    (2)

      (CDR (List))

    (3)

       (setq a (list 1 2 3))

       

       (setq b (list 4 5 6 a))

      : !b       (4 5 6 (1 2 3))

       (setq c (cdr b))

      : !c       (5 6 (1 2 3))

       (setq b (list a 4 5 6))

      : !b       ((1 2 3) 4 5 6)

       (setq c (cdr b))

      : !c       (4 5 6)

       (setq a (list 1 2 3 4 5))

       

       (setq b (cdr a))

      : !b       (2 3 4 5 6)

     

     

7. LAST

    (1)

      List Ҹ ޾Ƶδ.

    (2)

      (LAST (List))

    (3)

       (setq a (list 1 2 3))

       

       (setq b (last a))

      : !b       3

       (setq b (list 4 5 6 a))

      : !b       (4 5 6 (1 2 3))

       (setq c (last b))

      : !c       (1 2 3)

       (setq b (list 4 5 6))

       

       (setq c (list a b))

      : !c       ((1 2 3) (4 5 6))

       (setq d (last c))

      : !d       (4 5 6)

 

 

8. Length

    (1)

      List Atom ˾ .

    (2)

      (Length (List))

    (3)

       (setq a (list 1 2 3 4 5 6))

       

       (setq b (length a))

      : !b       6

       (setq c (list a 7 8 9 10))

      : !c       ((1 2 3 4 5 6) 7 8 9 10)

       (setq d (length c))

      : !d       5

       

       

9. REVERSE

    (1)

      List Ҹ ڹٲ Ű Լ

    (2)

      (REVERSE list)

    (3)

       (setq a (list 1 2 3 4 5 6))

       

       (setq b (reverse a))

      : !b       (6 5 4 3 2 1)

       (setq c (list a 7 8 9 10))

      : !c       ((1 2 3 4 5 6) 7 8 9 10)

       (setq d (reverse c))

      : !d       (10 9 8 7 (1 2 3 4 5 6))

 

 

10. MEMBER

    (1)

      List ù° Һ

    (2)

      (MEMBER expr list)

    (3)

       (setq a (list 1 2 3 4 5 6))

       

       (setq b (member 3 a))

      : !b       (3 4 5 6)

       (setq c (list "7" "8" "9" "10"))

      : !c       ("7" "8" "9" "10")

       (setq d (member "9" c))

      : !d       ("9" "10")

 

 

11. ASSOC (ASSOCiate)

    (1)

      ߿ ϰ ִ Ÿ ϴ Լ

    (2)

      (ASSOC <item> <list>)

    (3)

 

 

12. SUBST (SUBSTitute)

    (1)

      Ÿ ο Ÿ ġȯŰ Լ

    (2) 

      (SUBST <new item> <old item> <list>)

    (3)

 

 

13. CONS (CONStant)

    (1)

      List Item ù Ҹ Բ ԽŰ Լ

    (2)

      (CONS <item> <list>)

    (3)

 

 

14. APPEND

    (1)

      List ϳ List ȥսŰ Լ

    (2)

      (APPEND  list-1  list-2 ....)

    (3)

 

 

15. APPLY

    (1)

      List ϴ Լ ϴ Լ

    (2)

      (APPLY <function> <list>)

    (3)

 

 

16. FOREACH

    (1)

      List Ҹ ϳϳ <val> ġϿ <expr> óϴ Լ

    (2)

      (FOREACH <val> <list> <expr>)

    (3)

 

 

17. LISTP

    (1)

      Ұ List Ǿ ִ ľϴ Լ.

      (Atom Ǿ Nil Ѵ.)

    (2)

      (LISTP  list)

    (3)

 

 

18. MAPCAR

    (1)

      List List ԼϿ óϰ, List ִ Լ. (ԵǴ List ϵǴ List .)

    (2)

      (MAPCAR  function  list)

    (3)

 

 

 Լ

ۼ 2000.02.25

COMMAND Լ

2006.03.24