Skip to content

Commit 264a382

Browse files
authored
Obsolete more built-in aliases. (#207)
- Make `command-do` the default name and `group` the obsolete alias. - Rename `loopy--parse-group-command` to `loopy--parse-command-do-command`. - Obsolete `expr` and `exprs` for `set`. - Obsolete `prev-expr` for `set-prev`. Remove mention of the alias `prev` from the Org documentation, which should have been done in the previous round of obsoletions. - Update Texinfo file. See this PR #207 and issue #168, as well as previous obsoletions in PR #206 and issue #126.
1 parent 38126cc commit 264a382

File tree

6 files changed

+90
-122
lines changed

6 files changed

+90
-122
lines changed

CHANGELOG.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,20 @@ This document describes the user-facing changes to Loopy.
1818
- Remove the deprecated positional arguments to the `numbers` command ([#205]).
1919

2020
- To cut back on an over-abundance of choice and to simplify documentation, the
21-
following built-in aliases have been made obsolete ([#126], [#206]). They can
22-
still be added manually via `loopy-defalias`.
21+
following built-in aliases have been made obsolete ([#126], [#168], [#206],
22+
[#207]). They can still be added manually via `loopy-defalias`.
2323
- `array`: `across`
2424
- `array-ref`: `arrayf`, `arrayingf`, `stringf`, `stringingf`, `across-ref`
25+
- `command-do`: `group`
2526
- `cons`: `on`
2627
- `list`: `in`
2728
- `list-ref`: `listf`, `listingf`, `in-ref`
2829
- `map-ref`: `mapf`, `mappingf`
2930
- `numbers`: `num`, `nums`
3031
- `numbers-down`: `nums-down`, `numdown`, `num-down`, `numsdown`
3132
- `numbers-up`: `nums-up`, `numup`, `num-up`, `numsup`
32-
- `set-prev`: `prev`
33+
- `set`: `expr`, `exprs`
34+
- `set-prev`: `prev`, `prev-expr`
3335
- `sequence`: `elements`
3436
- `sequence-index`: `sequencei`, `seqi`, `listi`, `arrayi`, `stringi`
3537
- `sequence-ref`: `seqf`, `sequencef`, `sequencingf`, `elements-ref`
@@ -42,10 +44,12 @@ This document describes the user-facing changes to Loopy.
4244

4345

4446
[#126]: https://github.com/okamsn/loopy/issues/126
47+
[#168]: https://github.com/okamsn/loopy/issues/168
4548
[#169]: https://github.com/okamsn/loopy/issues/169
4649
[#203]: https://github.com/okamsn/loopy/pull/203
4750
[#205]: https://github.com/okamsn/loopy/pull/205
4851
[#206]: https://github.com/okamsn/loopy/pull/206
52+
[#207]: https://github.com/okamsn/loopy/pull/207
4953

5054

5155
## 0.13.0

doc/loopy-doc.org

+15-27
Original file line numberDiff line numberDiff line change
@@ -658,11 +658,10 @@ is assigned a value from the list after collecting =i= into =coll=.
658658
#+END_SRC
659659

660660
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]]).
666665

667666
Similar to other libraries, many commands have an alias of the
668667
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.
682681
For simplicity, the commands are described using the following notation:
683682

684683
- 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=.
686685
- =VAR= is an unquoted symbol that will be used as a variable name, such as =i=
687686
in =(list i my-list)=.
688687
- =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.
13031302
(do (message "%d" i)))
13041303
#+END_SRC
13051304

1306-
#+findex: group
13071305
#+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
13091307
=progn=. This is similar to =do=, but runs commands instead of normal Lisp
13101308
expressions. Currently, this command is only useful when used within the
13111309
=if= command.
@@ -1314,15 +1312,6 @@ value and do no affect how the loop iterates.
13141312
;; Report whether an even number is found, or return the sum of
13151313
;; the list's elements. To be clear, this is not an idiomatic example.
13161314

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-
13261315
;; Returns the detected even number:
13271316
;; => 2
13281317
(loopy (list i '(1 3 2 5))
@@ -1337,11 +1326,11 @@ value and do no affect how the loop iterates.
13371326
#+findex: setting
13381327
#+findex: expr
13391328
#+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
13411330
=EXPR= is reached, it is used repeatedly for the rest of the loop. With no
13421331
=EXPR=, =VAR= is bound to ~nil~ during each iteration of the loop.
13431332

1344-
This command also has the aliases =setting= and =exprs=.
1333+
This command also has the aliases =setting=.
13451334

13461335
Unlike the Emacs Lisp function ~set~, the variable name should not be quoted.
13471336
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.
13661355
#+findex: set-prev
13671356
#+findex: setting-prev
13681357
#+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
13751362
recording =VAL=; it always uses the value from the =BACK=-th previous cycle,
13761363
regardless of when the command is run. The value used is always the value at
13771364
the end of the cycle.
13781365

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=.
13801368

13811369
#+begin_src emacs-lisp
13821370
;; => (nil 1 2 3 4)
@@ -4411,7 +4399,7 @@ options ~loopy-iter-bare-commands~ and
44114399
~loopy-iter-bare-special-macro-arguments~.
44124400

44134401
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.
44154403

44164404
- Commands that exists only as a command version of an existing Lisp feature,
44174405
such as =if=, =cond=, =when=, and =unless=.

0 commit comments

Comments
 (0)