5. Stepping is the process of assigning the variable the next item in the series of items.
6.
7. Order of execution Clauses are executed in the loop body in the order they appear in the source Execution is repeated until a clause terminates a loop or until the CL return, go or throw form is encountered. All variables are initialized first regardless of where the establishing clauses appear in the source The code for any initially clauses is collected into one progn in the order in which the clauses appear in the source. The code for any finally clauses is collected into one progn in the order in which the clauses appear in the source.
13. Append construct takes one form in its clause and appends the value of that form to the end of a list of values
14. The sum construct takes one form in its clause that must evaluate to a number and adds that number into a running total.
15. The count construct takes one form in its clause and counts the number of times that form evaluates to a non-nil value.
16. The minimize construct takes one form In clause and determines the minimum value obtained by evaluating the form.
17.
18. The always construct takes one form and terminates the loop if the form ever evaluates to nil. The never construct takes one form and terminates the loop if the form ever evaluates to non-nill The thereis construct takes one form and terminates the loop if the form ever evaluates to a non-nill. Unconditional execution: The do construct simply evaluates all forms in its clause. The return construct takes one form and returns its value.
19. Conditional execution: If construct one form as a predicate and a clause that is executed when the predicate is true. The when construct is a synonym for fi. The else construct provides an optional component of if, when and unless clauses that is executed when the prediction is false. The end construct provides an optional component to mark the end of a conditional clause.
20. Miscellaneous operations The named construct assigns a name to a loop construct. The initially construct causes its forms to be evaluated in the loop prologue, which proceeds all loop code except for initial settings specified by the constructs with, for, or as. The finally construct causes its forms to be evaluated in the loop epilogue after normal iteration terminates.
21. Loop syntax A loop consists of following type of clauses: Initial-final ::=initially|finally Variables ::=with|initial-final|for-as|repeat Main ::=unconditional|accumulation |conditional|termination|initial-final Loop ::=(loop [named name] {variables}* {main}* )
22. (loop {tag|expr}* ) Where expr is any CL expression that can be evaluated , and tag is any symbol not identifiable as a loop keyword. (loop do {tag|expr}*) A loop prologue consists of any automatic variable initializations prescribed by the variable clauses, along with any initially clauses in the order they appear in the source.
23. Examples for loops: ;;; To print some numbers (loop as i from 1 to 4 do (print i)) 1 2 3 4 NIL ;;; To print every third number (loop for i from 10 downto 1 by 3 do (print i)) 10 7 4 1 NIL
24. ;;; step incrementally from the default starting value (loop as i below 5 do (print i)) 0 1 2 3 4 NIL
25.
26. End-test control The loop keywords always, never, thereis, until, and while designate constructs that use a single test condition to determine when loop loop iteration should terminate. while expr while construct allows iteration to continue until the specified expression expr evaluates to nil. until expr until construct is equivalent to while, if the value of the specified expression is non-nil, iteration terminates. always expralways takes one form and terminates the loop if the form ever evaluates to nil.
27. Never expr never form takes one form and terminates the loop if the form ever evaluates to non-nill. thereis expr thereis construct takes one form and terminates the loop if the form ever evaluates to a non-nil. While and until constructs causes termination, control is passed to the loop epilogue, where any finally clauses will be executed.
28. Ex: (loop for i from 0 to 10 always ( < i 11)) T (loop for i from 0 to 10 never (> i 11)) T (loop for i from 0 to 10 always ( < i 9) finally (print “you won’t see this”))NIL (loop never t finally (print “you won’t see this”))NIL
29. (loop thereis “Here is my value” finally (print “you won’t see this”)) “here is my value” (loop for i from 0 to 10 thereis (when (> i 10) i) ) 11 (loop for i from 1 to 10 thereis (> i 11) finally (print i)) 11 NIL
30.
31. return expr return construct terminates the loop and returns the value of the specified expression as the value of the loop . Ex: (loop for item in ‘( 1 2 3 a 4 5) when (not (numberp item)) return (cerror “enter new value” “non-numeric value: ~s” item)) Error: non-numeric value: A
32. Data types type-spec argument that allows you to specify certain data types for loop variables. The type-spec argument syntax: type-spec ::=of-type d-type-spec d-type-spec ::=type-specifier|(d-type-spec . D-type-spec) The type-spec argument is used for destructing
33. Visit more self help tutorials Pick a tutorial of your choice and browse through it at your own pace. The tutorials section is free, self-guiding and will not involve any additional support. Visit us at www.dataminingtools.net