Lisp of the Day


(repeat int expr)

Loop through an expression a set number of time.

Repeat is one of my most commonly used functions when dealing with selection sets. Instead of using a while function, I will repeat the expression the length of the selection set. This will detour from the possibility of having an infinite loop by some strange means either forgetting to change the counter variable or something not modifying correctly.

(repeat (sslength (setq ss (ssget))))

(setq c 0)
(repeat 4 (setq c (1+ c))) returns 4


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: