From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: loop macro tutorial Date: Wed, 17 Jun 2009 18:26:01 +0200 Organization: Anevia SAS Message-ID: <7cr5xiu8rq.fsf@pbourguignon.anevia.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1245257677 26432 80.91.229.12 (17 Jun 2009 16:54:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Jun 2009 16:54:37 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jun 17 18:54:34 2009 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.50) id 1MGyPC-0003z5-98 for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Jun 2009 18:54:34 +0200 Original-Received: from localhost ([127.0.0.1]:51004 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MGyPB-00039e-Mm for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Jun 2009 12:54:33 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newsfeed.esat.net!kanaga.switch.ch!switch.ch!news.in2p3.fr!in2p3.fr!univ-lyon1.fr!news.cs.univ-paris8.fr!proxad.net!feeder1-2.proxad.net!212.27.60.64.MISMATCH!cleanfeed3-b.proxad.net!nnrp14-2.free.fr!not-for-mail Original-Newsgroups: gnu.emacs.help Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.101 (Gnus v5.10.10) Emacs/22.2 (gnu/linux) Cancel-Lock: sha1:NzdkOWYwYzVhYzMwZjk0YWYxODUwZGZhNTczMjZlMzEzYjUxMjljOA== Original-Lines: 39 Original-NNTP-Posting-Date: 17 Jun 2009 18:26:02 MEST Original-NNTP-Posting-Host: 88.170.236.224 Original-X-Trace: 1245255962 news-1.free.fr 441 88.170.236.224:46361 Original-X-Complaints-To: abuse@proxad.net Original-Xref: news.stanford.edu gnu.emacs.help:170120 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:65347 Archived-At: Michal writes: > Hallo group members. > > with C-h f loop, i get: > Valid clauses are: > for VAR from/upfrom/downfrom NUM to/upto/downto/above/below NUM by NUM, > for VAR in LIST by FUNC, for VAR on LIST by FUNC, for VAR = INIT then EXPR, > for VAR across ARRAY, repeat NUM, with VAR = INIT, while COND, until COND, > always COND, never COND, thereis COND, collect EXPR into VAR, > append EXPR into VAR, nconc EXPR into VAR, sum EXPR into VAR, > count EXPR into VAR, maximize EXPR into VAR, minimize EXPR into VAR, > if COND clause [and clause]... else clause [and clause...], > unless COND clause [and clause]... else clause [and clause...], > do EXPRS..., initially EXPRS..., finally EXPRS..., return EXPR, > finally return EXPR, named NAME. > > > I does not tell me anything. > Do You know any sites that would explain 'loop' in more clear way? It comes from CLtL LOOP, which we find in Common Lisp too: http://www.lispworks.com/reference/HyperSpec/Body/m_loop.htm http://www.lispworks.com/documentation/HyperSpec/Body/06_a.htm http://www.gigamonkeys.com/book/loop-for-black-belts.html There are some small differences between CLtL LOOP and Common Lisp LOOP (eg CL LOOP doesn't accept finally return EXPR, you have to write in CL finally (return EXPR)), and of course, there are the restrictions of emacs lisp (only dynamic bindings, no lexical binding), and you cannot use keywords for the loop key words, but otherwise they're quite similar, so you can use the above documents to learn how to use emacs lisp loop. -- __Pascal Bourguignon__