Lisp 3 PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

AutoLISP

, ,
, , ,

.
AutoLISP.
(predicates) (logical boolean) . , (evaluation) ()
nil ( ). ,
nil. ,
[ ], .
1.
(= item item ...): T,
, nil. .
(/= item item ): nil, , T (/= , ). .
.
(< item item ...): T, . nil. .
(<= item item ...): T,
. nil. .
(> item item ...): T, . nil.
.
(>= item item ...): T, , ,
. nil.
.
(equal expr1 expr2 [ fuzz ]): expr1 expr2 , T, nil.
=, (atom:
LISP ). ,
,
. fuzz ,
expr1 expr2,
.
: n1 0.53612 n2 0.53613,
(equal n1 n2)
nil,
(equal n1 n2 0.00001)
T.
(and expr ...): AND. expr ... nil,
nil. T.
(not expr ): . T, expr
nil, nil.
(or expr ...): OR. expr ... T,
nil. nil.
:
(or (> 2 3)(< 2 3)(= 2 "a")) T.
2.
: if ( )
cond ( ). progn,

2
, . progn , ,
if. progn if (. . ,
& , , 2007, . 1043),
THEN ELSE.
(progn expr ...): expr ..., , .
, .
(if testexpr thenexpr [ elseexpr ]): thenexpr,
testexpr nil, elseexpr.
. elseexpr testexpr nil, nil. thenexpr elseexpr
, , , progn.
:
(if (equal a b)(princ "a equal b")(princ "a not equal b"))
"a equal b", a b
, "a not equal b".
(cond [( test1 result1 ...) ...]): ,
. resultn ... (
), testn nil.
testn,
. testn nil, nil.
3.
repeat while, .
foreach, ,
LISP.
(while testexpr expr ...): testexpr nil,
expr ... , testexpr
nil, expr.
(repeat number expr ...): number
expr ... . number
.
(foreach element list expr ...): list,
element expr ...
. .
:
(foreach ch '("a" "b" "c")(princ ch))
"abc" "c".
4.
LISP, , . , ,
LISP, .
,
,
. ,
.

2009

You might also like