From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: RG Newsgroups: gmane.emacs.help Subject: Re: How to cast an imperative loop into a readable recursive function ? Date: Thu, 02 Dec 2010 18:48:15 -0800 Organization: Amalgamated Widgets Unlimited Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1291957167 13683 80.91.229.12 (10 Dec 2010 04:59:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 10 Dec 2010 04:59:27 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 10 05:59:23 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PQv4l-0006ms-2P for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Dec 2010 05:59:23 +0100 Original-Received: from localhost ([127.0.0.1]:59825 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQuu7-000751-Kr for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 23:48:23 -0500 Original-Path: usenet.stanford.edu!fu-berlin.de!news.albasani.net!rNOSPAMon Original-Newsgroups: comp.lang.lisp,comp.emacs,gnu.emacs.help Original-Lines: 26 Original-X-Trace: news.albasani.net hHTD8axll/Zm65h38ClN8rpG6AC+I2gTdms8ZOQikNBHyvTcE6whUNYOPSKr0JZXRygP71BNSwvwo6nLKwUbUQ== Original-NNTP-Posting-Date: Fri, 3 Dec 2010 02:48:16 +0000 (UTC) Cancel-Lock: sha1:0H/JkFBTG1eip0cr9Bb+4K8TZ68= User-Agent: MT-NewsWatcher/3.5.1 (Intel Mac OS X) Injection-Info: news.albasani.net; logging-data="paCBKG4MHH22wh3MWinlv/FANZldZCEU+4Y4+pb4NFgiAWFLB666Vr5TezUDSBACgmw5IgEffSMjHttNDhPnLsey1jp5gkf793rp585SZW0Q3uLr5/cIaVOKnPDRBrhh"; mail-complaints-to="abuse@albasani.net" Original-Xref: usenet.stanford.edu comp.lang.lisp:296037 comp.emacs:100884 gnu.emacs.help:182788 X-Mailman-Approved-At: Thu, 09 Dec 2010 20:23:28 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:77348 Archived-At: In article , Katalin Sinkov wrote: > How to cast an imperative loop into a readable recursive function ? What is a readable function? Ignoring that part, you can always rewrite something like: (while condition ...) as (iterate loop () (when condition ... (loop))) where iterate is defined as: (defmacro iterate (name args &rest body) `(labels ((,name ,(mapcar 'first args) ,@body)) (,name ,@(mapcar 'second args)))) Is that what you meant? rg