Este arquivo mostra algumas listas do AutoLISP© e algumas das SUBR (subrotinas) desta linguagem para acessar seus 'atomos' (em autolisp, todo elemento de uma lista é um átomo) |
;; Exemplos de listas...
(SETQ lista1 '(1 2 3 4 5 6 7 8 9 10))
;; Lista1 ; retorna (1 2 3 4 5 6 7 8 9 10)
(CAR lista1) ; retorna 1
(CADR lista1) ; retorna 2
(CADDR lista1) ; retorna 3
(CADDDR lista1) ; retorna 4
(CDR lista1) ; retorna (2 3 4 5 6 7 8 9 10)
(CDDR lista1) ; retorna (3 4 5 6 7 8 9 10)
(CDDDR lista1) ; retorna (4 5 6 7 8 9 10)
(REVERSE lista1) ; retorna (10 9 8 7 6 5 4 3 2 1)
(MEMBER 3 lista1) ; retorna (3 4 5 6 7 8 9 10)
(MEMBER 8 lista1) ; retorna (8 9 10)
(NTH 0 lista1) ; retorna 1
(NTH 1 lista1) ; retorna 2
(NTH 2 lista1) ; retorna 3
(NTH 3 lista1) ; retorna 4
(NTH 4 lista1) ; retorna 5
(NTH 5 lista1) ; retorna 6
(NTH 6 lista1) ; retorna 7
(NTH 7 lista1) ; retorna 8
(NTH 8 lista1) ; retorna 9
(NTH 9 lista1) ; retorna 10
(NTH 10 lista1) ; retorna nil
(LAST lista1) ; retorna 10
(SETQ lista2 (LIST 1 2 3 4 5 6 7 8 9 10))
;; Lista2 retorna (1 2 3 4 5 6 7 8 9 10)
(SETQ a 1 b 2 c 3 d 4 e 5 f 6 g 7 h 8 i 9 j 10)
(SETQ lista3 (LIST a b c d e f g h i j))
;; Lista3 retorna (1 2 3 4 5 6 7 8 9 10)
(SETQ lista4
'(("PARAFU1" 16)
("PARAFU2" 20)
("PARAFU3" 25)
("PARAFU4" 30))
;; Lista4 retorna (("PARAFU1" 16)("PARAFU2" 20)("PARAFU3" 25)("PARAFU4" 30))
(ASSOC "PARAFU1" lista4) ; retorna ("PARAFU1" 16)
(CAR (ASSOC "PARAFU1" lista4)) ; retorna "PARAFU1"
(CADR (ASSOC "PARAFU1" lista4)) ; retorna 16
A linguagem DCL
Anterior
Home