help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to cast an imperative loop into a readable recursive function ?


From: RG
Subject: Re: How to cast an imperative loop into a readable recursive function ?
Date: Thu, 02 Dec 2010 18:48:15 -0800
User-agent: MT-NewsWatcher/3.5.1 (Intel Mac OS X)

In article 
<ffc3587e-3cb3-41f6-9b2f-80a22d5095d1@e20g2000vbn.googlegroups.com>,
 Katalin Sinkov <lispstylist@gmail.com> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]