@@ -658,11 +658,10 @@ is assigned a value from the list after collecting =i= into =coll=.
658
658
#+END_SRC
659
659
660
660
For convenience and understanding, the same command might have multiple names,
661
- called {{{dfn(aliases)}}}. For example, the command =set= has an alias =expr=,
662
- because =set= is used to /set/ a variable to the value of an /expression/.
663
- Similary, the =array= command has the alias =string=, because the =array=
664
- command can be used to iterate through the elements of an array or string[fn:1].
665
- You can define custom aliases using the macro ~loopy-defalias~ ([[#custom-aliases][Custom Aliases]]).
661
+ called {{{dfn(aliases)}}}. Similary, the =array= command has the alias
662
+ =string=, because the =array= command can be used to iterate through the
663
+ elements of an array or string[fn:1]. You can define custom aliases using the
664
+ macro ~loopy-defalias~ ([[#custom-aliases][Custom Aliases]]).
666
665
667
666
Similar to other libraries, many commands have an alias of the
668
667
present-participle form (the "-ing" form). A few examples are seen in the table
@@ -682,7 +681,7 @@ command iterates through the elements in the list.
682
681
For simplicity, the commands are described using the following notation:
683
682
684
683
- If a command has multiple names, the names are separated by a vertical bar,
685
- such as in =set|expr =.
684
+ such as in =array|string =.
686
685
- =VAR= is an unquoted symbol that will be used as a variable name, such as =i=
687
686
in =(list i my-list)=.
688
687
- =FUNC= is a quoted Lisp function name, such as ~#'my-func~ or ~'my-func~, a
@@ -1303,9 +1302,8 @@ value and do no affect how the loop iterates.
1303
1302
(do (message "%d" i)))
1304
1303
#+END_SRC
1305
1304
1306
- #+findex: group
1307
1305
#+findex: command-do
1308
- - =(group| command-do [CMDS])= :: Evaluate multiple loop commands, as if in a
1306
+ - =(command-do [CMDS])= :: Evaluate multiple loop commands, as if in a
1309
1307
=progn=. This is similar to =do=, but runs commands instead of normal Lisp
1310
1308
expressions. Currently, this command is only useful when used within the
1311
1309
=if= command.
@@ -1314,15 +1312,6 @@ value and do no affect how the loop iterates.
1314
1312
;; Report whether an even number is found, or return the sum of
1315
1313
;; the list's elements. To be clear, this is not an idiomatic example.
1316
1314
1317
- ;; Returns sum:
1318
- ;; => 9
1319
- (loopy (list i '(1 3 5))
1320
- (if (cl-evenp i)
1321
- (group
1322
- (do (message "Even found."))
1323
- (return i))
1324
- (sum i)))
1325
-
1326
1315
;; Returns the detected even number:
1327
1316
;; => 2
1328
1317
(loopy (list i '(1 3 2 5))
@@ -1337,11 +1326,11 @@ value and do no affect how the loop iterates.
1337
1326
#+findex: setting
1338
1327
#+findex: expr
1339
1328
#+findex: exprs
1340
- - =(set|expr VAR [EXPRS])= :: Bind =VAR= to each =EXPR= in order. Once the last
1329
+ - =(set VAR [EXPRS])= :: Bind =VAR= to each =EXPR= in order. Once the last
1341
1330
=EXPR= is reached, it is used repeatedly for the rest of the loop. With no
1342
1331
=EXPR=, =VAR= is bound to ~nil~ during each iteration of the loop.
1343
1332
1344
- This command also has the aliases =setting= and =exprs= .
1333
+ This command also has the aliases =setting=.
1345
1334
1346
1335
Unlike the Emacs Lisp function ~set~, the variable name should not be quoted.
1347
1336
Unlike the Emacs Lisp special form ~setq~, the command =set= only sets one
@@ -1366,17 +1355,16 @@ value and do no affect how the loop iterates.
1366
1355
#+findex: set-prev
1367
1356
#+findex: setting-prev
1368
1357
#+findex: prev-set
1369
- #+findex: prev-expr
1370
- #+findex: prev
1371
- - =(set-prev|prev-expr VAR VAL &key back)= :: Bind =VAR= to a value =VAL= from a
1372
- previous cycle in the loop. With =BACK= (default: 1), use the value from that
1373
- many cycles previous. _If not enough cycles have passed yet, then the value
1374
- of =VAR= is not modified._ This command /does not/ work like a queue for
1358
+ - =(set-prev VAR VAL &key back)= :: Bind =VAR= to a value =VAL= from a previous
1359
+ cycle in the loop. With =BACK= (default: 1), use the value from that many
1360
+ cycles previous. _If not enough cycles have passed yet, then the value of
1361
+ =VAR= is not modified._ This command /does not/ work like a queue for
1375
1362
recording =VAL=; it always uses the value from the =BACK=-th previous cycle,
1376
1363
regardless of when the command is run. The value used is always the value at
1377
1364
the end of the cycle.
1378
1365
1379
- This command also has the aliases =setting-prev=, =prev-set=, and =prev=.
1366
+ This command also has the aliases =setting-prev= and, for typo tolerance,
1367
+ =prev-set=.
1380
1368
1381
1369
#+begin_src emacs-lisp
1382
1370
;; => (nil 1 2 3 4)
@@ -4411,7 +4399,7 @@ options ~loopy-iter-bare-commands~ and
4411
4399
~loopy-iter-bare-special-macro-arguments~.
4412
4400
4413
4401
By default, the following commands are not recognized:
4414
- - =do= and =group =, which are not needed.
4402
+ - =do= and =command-do =, which are not needed.
4415
4403
4416
4404
- Commands that exists only as a command version of an existing Lisp feature,
4417
4405
such as =if=, =cond=, =when=, and =unless=.
0 commit comments