[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LABEL



Did LABEL go away? COMPLR says it won't support it. But the interpreter
still supports:

  ;; 'Normal' recursive factorial

(DEFUN RECURSIVE-F (X)
       ((LABEL FOO #'(LAMBDA (X)
		        (COND ((ZEROP X) 1.)
			      (T (TIMES X (FUNCALL FOO (SUB1 X)))))))
	X))

  ;; ... and (you guessed it, lossage fans) ... the iterative version ...

(DEFUN ITERATIVE-F (X)
       ((LABEL FOO #'(LAMBDA (X)
			     (SETQ FOO 1)
			     (DO ((X X (1- X)))
				 ((< X 2) FOO)
				 (SETQ FOO (TIMES X FOO)))))
	X))