unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: pjb@informatimago.com (Pascal J. Bourguignon)
To: help-gnu-emacs@gnu.org
Subject: Re: loop macro tutorial
Date: Wed, 17 Jun 2009 18:26:01 +0200	[thread overview]
Message-ID: <7cr5xiu8rq.fsf@pbourguignon.anevia.com> (raw)
In-Reply-To: m2ws7aonez.fsf@tenbit.pl

Michal <rabbitko@tenbit.pl> 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__


  reply	other threads:[~2009-06-17 16:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-17 16:06 loop macro tutorial Michal
2009-06-17 16:26 ` Pascal J. Bourguignon [this message]
2009-06-17 17:20   ` Drew Adams
2009-06-23 14:40   ` Michal
     [not found]   ` <mailman.805.1245259242.2239.help-gnu-emacs@gnu.org>
2009-06-23 14:41     ` Michal
2009-06-17 18:18 ` Johan Bockgård
     [not found] ` <mailman.812.1245262811.2239.help-gnu-emacs@gnu.org>
2009-06-23 14:39   ` Michal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7cr5xiu8rq.fsf@pbourguignon.anevia.com \
    --to=pjb@informatimago.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).