Just posting for posting sake (Im trying to get my numbers up
).
Here is two offered as `food fer thought'.
1.) create variables more hygienically (as mentioned in On-Lisp).
2.) cause the local/global variable situation needs to be obfuscated more (
). CAB, this situation would be kind of an answer to your question (but the "real life" answer would be more like: never. ...maybe an end user pick point list...?)
( (lambda ( / aif)
(defun aif ( var expr iffalse )
;; anaphoric-if
;;
;; ported to AutoLisp from ?comonLisp?
;; I dont know the whole extents of the CL`aif' function, im only
;; working from one small definition.
;;
;; EX:
;; (aif 'a (getint "\nEnter new value [1]: ") 1)
;;
(set var (cond (expr) (iffalse))) )
;; Resirected for argument sake. ...*lmao*
(initget 6)
(aif 'rad (getdist "\nCircle Radius [1]: ") 1)
(aif 'seg (getint "\nCircle Segmemts [16]: ") 16)
(setq ang 0
inc (/ (* pi 2) seg)
p 0)
(repeat seg
(set (read (strcat "P" (itoa p)))
(polar '(0 0 0) ang rad))
(setq ang (+ ang inc)
p (1+ p)))
)
)
( (lambda ( / let)
(defun let (bindings body)
;; let for autolisp.
;;
;; Ex:
;; (let '((x 10) (y 20)) ; bindings
;; '((princ "\nLocal values of X and Y: ") ; body
;; (prin1 x)
;; (prin1 y)
;; (princ)
;; )
;; )
;;
(eval
(cons (append (list 'lambda (mapcar 'car bindings)) body)
(mapcar 'cadr bindings))) )
(initget 6)
(let
;; bindings
'(
(rad
(cond
((getdist "\nCircle Radius [1]: "))
(1))
)
(seg
(cond
((getint "\nCircle Segmemts [16]: "))
(16))
)
)
;; body
'(
(setq ang 0
inc (/ (* pi 2) seg)
p 0)
(repeat seg
(set (read (strcat "P" (itoa p)))
(polar '(0 0 0) ang rad))
(setq ang (+ ang inc)
p (1+ p))
(print (read (strcat "P" (itoa p))))
)
)
)
)
)
;; (mapcar
;; '(lambda ( x ) (setq x nil))
;; '(P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 P11 P12 P13 P14 P15 P16)
;; )