dotill

(dotill predicate expression [max-iterations])


Description:

Keep running the expression until predicate is matched or until max-iterations is reached.  If predicate is matched the result of the final expression (i.e. value) is returned. If max-iterations is reached the symbol failed will be returned. The result of evaluating expression is bound to value on each iterations so your predicate may use value to retrieve the result.  check the examples for example usage.  max-iterations is optional and defaults to 10000000


Arguments:

            obj -- The obj to set at key in alist

            key -- The key to use for replace

          alist -- the associative list to set obj for key


Returns: The result of the final evaluation of expression or 'failed if max-iterations is reached first


Related:  


Examples:

(dotill (= (length value) 5) (make-list (random 10) 'a))

(dotill (= (length value) 5) (make-list (random 100) 'a) 10)



Back to index