Skip to content

Commit 5d76199

Browse files
committed
Deprecate some aliases and prefer "sequence" to "seq" in built-in names.
- To cut back on an over-abundance of choice and to simplify documentation, the following built-in aliases have been made obsolete. They can still be added manually via `loopy-defalias`. - `array`: `across` - `array-ref`: `arrayf`, `arrayingf`, `stringf`, `stringingf`, `across-ref` - `cons`: `on` - `list`: `in` - `list-ref`: `listf`, `listingf`, `in-ref` - `map-ref`: `mapf`, `mappingf` - `numbers`: `num`, `nums` - `numbers-down`: `nums-down`, `numdown`, `num-down`, `numsdown` - `numbers-up`: `nums-up`, `numup`, `num-up`, `numsup` - `set-prev`: `prev` - `seq`: `elements` - `seq-index`: `sequencei`, `seqi`, `listi`, `arrayi`, `stringi` - Document the aliases `mapping-ref`, `listing-ref`, `arraying-ref`, `stringing-ref`, and `sequencing-ref`. - Make `sequence`, `sequence-ref`, `sequence-index` the default names in the code and the remaining places in the documentation. This was already the case for most of the documentation. See this PR #206 and issue #126.
1 parent 455c14b commit 5d76199

File tree

4 files changed

+103
-70
lines changed

4 files changed

+103
-70
lines changed

CHANGELOG.md

+27
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,36 @@ This document describes the user-facing changes to Loopy.
1717

1818
- Remove the deprecated positional arguments to the `numbers` command ([#205]).
1919

20+
- 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`.
23+
- `array`: `across`
24+
- `array-ref`: `arrayf`, `arrayingf`, `stringf`, `stringingf`, `across-ref`
25+
- `cons`: `on`
26+
- `list`: `in`
27+
- `list-ref`: `listf`, `listingf`, `in-ref`
28+
- `map-ref`: `mapf`, `mappingf`
29+
- `numbers`: `num`, `nums`
30+
- `numbers-down`: `nums-down`, `numdown`, `num-down`, `numsdown`
31+
- `numbers-up`: `nums-up`, `numup`, `num-up`, `numsup`
32+
- `set-prev`: `prev`
33+
- `sequence`: `elements`
34+
- `sequence-index`: `sequencei`, `seqi`, `listi`, `arrayi`, `stringi`
35+
- `sequence-ref`: `seqf`, `sequencef`, `sequencingf`, `elements-ref`
36+
37+
- Make `sequence` the default name and `seq` an alias ([#126, #206]).
38+
39+
- Make `sequence-ref` the default name and `seq-ref` an alias ([#126, #206]).
40+
41+
- Make `sequence-index` the default name and `seq-index` an alias ([#126, #206]).
42+
43+
44+
[#126]: https://github.com/okamsn/loopy/issues/126
2045
[#169]: https://github.com/okamsn/loopy/issues/169
2146
[#203]: https://github.com/okamsn/loopy/pull/203
2247
[#205]: https://github.com/okamsn/loopy/pull/205
48+
[#206]: https://github.com/okamsn/loopy/pull/206
49+
2350

2451
## 0.13.0
2552

README.org

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ please let me know.
3535
a warning. In the future, they will signal an error.
3636
- The positional arguments to the =numbers= command have been removed,
3737
being deprecated since version 0.12.0.
38+
- Some built-in aliases have been made obsolete and will be removed from the
39+
list of built-in aliases in the future. They can still be added to the
40+
list of known aliases using ~loopy-defalias~. See the changelog for more
41+
information.
3842
- Version 0.13.0:
3943
- The deprecated =:init= keyword argument has been removed. Use the =with=
4044
special macro argument instead.

doc/loopy-doc.org

+29-42
Original file line numberDiff line numberDiff line change
@@ -2080,7 +2080,7 @@ source sequences.
20802080
library =seq.el=.
20812081
#+end_quote
20822082

2083-
This command also has the aliases =seqing= and =sequencing=.
2083+
This command also has the aliases =sequencing= and =seqing=.
20842084

20852085
=KEYS= is one or several of =from=, =upfrom=, =downfrom=, =to=, =upto=,
20862086
=downto=, =above=, =below=, =by=, =test=, and =index=. =index= names the
@@ -2235,32 +2235,25 @@ same keywords as the =numbers= command ([[#numeric-iteration]]) for working with
22352235
the index and choosing a range of the sequence elements through which to
22362236
iterate.
22372237

2238+
#+findex: sequence-index
2239+
#+findex: sequencing-index
22382240
#+findex: seq-index
2239-
#+findex: seqi
22402241
#+findex: seqing-index
2241-
#+findex: sequencing-index
2242-
#+findex: seqi
22432242
#+findex: array-index
22442243
#+findex: arraying-index
2245-
#+findex: arrayi
22462244
#+findex: list-index
22472245
#+findex: listing-index
2248-
#+findex: listi
22492246
#+findex: string-index
22502247
#+findex: stringing-index
2251-
#+findex: stringi
2252-
- =(seq-index VAR EXPR &key KEYS)= :: Iterate through the indices of =EXPR=.
2248+
- =(sequence-index VAR EXPR &key KEYS)= :: Iterate through the indices of =EXPR=.
22532249

22542250
There is only one implementation of this command; there are no
22552251
type-specific versions. This command also has the following aliases:
2256-
- =array-index=, =arraying-index=, =arrayi=
2257-
- =list-index=, =listing-index=, =listi=
2258-
- =string-index=, =stringing-index=, =stringi=
2259-
- =sequence-index=, =sequenceing-index=, =sequencei=, =seqi=, =seqing-index=
2260-
2252+
- =array-index=, =arraying-index=
2253+
- =list-index=, =listing-index=
2254+
- =string-index=, =stringing-index=
2255+
- =sequencing-index=, =seq-index=, =seqing-index=
22612256

2262-
The aliases =seqi=, =arrayi=, =listi=, and =stringi= are similar to the
2263-
aliases =seqf=, =arrayf=, =listf=, and =stringf= of the =seq-ref= command.
22642257

22652258
=KEYS= is one or several of =from=, =upfrom=, =downfrom=, =to=, =upto=,
22662259
=downto=, =above=, =below=, =by=, and =test=. For their meaning, see the
@@ -2290,7 +2283,7 @@ iterate.
22902283

22912284
#+begin_src emacs-lisp
22922285
;; => (0 1 2)
2293-
(loopy (seq-index i [1 2 3])
2286+
(loopy (sequence-index i [1 2 3])
22942287
(collect i))
22952288

22962289
;; => (0 1 2)
@@ -2303,7 +2296,7 @@ iterate.
23032296

23042297
;; => (8 6 4 2)
23052298
(loopy (with (my-seq [0 1 2 3 4 5 6 7 8 9 10]))
2306-
(seq-index idx my-seq :from 8 :downto 1 :by 2)
2299+
(sequence-index idx my-seq :from 8 :downto 1 :by 2)
23072300
(collect (elt my-seq idx)))
23082301
#+end_src
23092302

@@ -2365,17 +2358,13 @@ they also have an =index= keyword, which names the variable used to store
23652358
the accessed index during the loop.
23662359

23672360
#+findex: array-ref
2368-
#+findex: arrayf
23692361
#+findex: string-ref
2370-
#+findex: stringf
23712362
#+findex: arraying-ref
2372-
#+findex: arrayingf
23732363
#+findex: stringing-ref
2374-
#+findex: stringingf
2375-
#+findex: across-ref
2376-
- =(array-ref|arrayf|string-ref|stringf VAR EXPR &key KEYS)= :: Loop
2377-
through the elements of the array =EXPR=, binding =VAR= as a ~setf~-able
2378-
place.
2364+
- =(array-ref|string-ref VAR EXPR &key KEYS)= :: Loop through the elements of
2365+
the array =EXPR=, binding =VAR= as a ~setf~-able place.
2366+
2367+
This command also has the aliases =arraying-ref= and =stringing-ref=.
23792368

23802369
=KEYS= is one or several of =from=, =upfrom=, =downfrom=, =to=, =upto=,
23812370
=downto=, =above=, =below=, =by=, and =index=. =index= names the variable
@@ -2404,12 +2393,11 @@ the accessed index during the loop.
24042393

24052394
#+findex: list-ref
24062395
#+findex: listing-ref
2407-
#+findex: listf
2408-
#+findex: listingf
2409-
#+findex: in-ref
2410-
- =(list-ref|listf VAR EXPR &key by)= :: Loop through the elements of
2411-
the list =EXPR=, binding =VAR= as a ~setf~-able place. Optionally, update
2412-
the list via function =by= instead of ~cdr~.
2396+
- =(list-ref VAR EXPR &key by)= :: Loop through the elements of the list =EXPR=,
2397+
binding =VAR= as a ~setf~-able place. Optionally, update the list via
2398+
function =by= instead of ~cdr~.
2399+
2400+
This command also has the aliases =listing-ref=.
24132401

24142402
#+BEGIN_SRC emacs-lisp
24152403
;; => (7 7 7)
@@ -2439,11 +2427,11 @@ the accessed index during the loop.
24392427

24402428
#+findex: map-ref
24412429
#+findex: mapping-ref
2442-
#+findex: mapf
2443-
#+findex: mappingf
2444-
- =(map-ref|mapf VAR EXPR &key key unique)= :: Loop through the values of
2445-
map =EXPR=, binding =VAR= as a ~setf~-able place. Like the command =map=,
2446-
this command uses the =map.el= library.
2430+
- =(map-ref VAR EXPR &key key unique)= :: Loop through the values of map =EXPR=,
2431+
binding =VAR= as a ~setf~-able place. Like the command =map=, this command
2432+
uses the =map.el= library.
2433+
2434+
This command also has the alias =mapping-ref=.
24472435

24482436
=key= is a variable in which to store the current key for the ~setf~-able
24492437
place referred to by =VAR=. This is similar to the =index= keyword parameter
@@ -2491,17 +2479,16 @@ the accessed index during the loop.
24912479
(finally-return map loopy-result))
24922480
#+end_src
24932481

2494-
#+findex: seq-ref
2495-
#+findex: seqf
24962482
#+findex: sequence-ref
24972483
#+findex: sequencing-ref
2498-
#+findex: sequencef
2499-
#+findex: sequencingf
2500-
#+findex: elements-ref
2501-
- =(sequence-ref|sequencef|seq-ref|seqf VAR EXPR &key KEYS)= :: Loop
2484+
#+findex: seq-ref
2485+
#+findex: seqing-ref
2486+
- =(sequence-ref|seq-ref VAR EXPR &key KEYS)= :: Loop
25022487
through the elements of the sequence =EXPR=, binding =VAR= as a
25032488
~setf~-able place.
25042489

2490+
This command also has the aliases =sequencing-ref= and =seqing-ref=.
2491+
25052492
=KEYS= is one or several of =from=, =upfrom=, =downfrom=, =to=, =upto=,
25062493
=downto=, =above=, =below=, =by=, =test=, and =index=. =index= names the
25072494
variable used to store the index being accessed. For others, see the

loopy-vars.el

+43-28
Original file line numberDiff line numberDiff line change
@@ -74,26 +74,39 @@ Definition must exist. Neither argument need be quoted."
7474
;; Add the alias for the new target name.
7575
(push alias (map-elt loopy-aliases true-name)))))))
7676

77+
(defvar loopy--obsolete-aliases
78+
'((array across)
79+
(array-ref arrayf arrayingf stringf stringingf across-ref)
80+
(cons on)
81+
(list in)
82+
(list-ref listf listingf in-ref)
83+
(map-ref mapf mappingf)
84+
(numbers num nums)
85+
(numbers-down nums-down numdown num-down numsdown)
86+
(numbers-up nums-up numup num-up numsup)
87+
(set-prev prev)
88+
(sequence elements)
89+
(sequence-index sequencei seqi listi arrayi stringi)
90+
(sequence-ref seqf sequencef sequencingf elements-ref))
91+
"Aliases to be removed from the documentation.")
92+
7793
;;;###autoload
7894
(defcustom loopy-aliases
7995
;; TODO: Is there a faster way to search for aliases?
8096
;; Would using a hash table with a flatter structure be better?
8197
;; Using `map-do' on a hash table seemed to be a bit slower for what
8298
;; we want?
83-
'((accumulate . (callf2 accumulating))
99+
'((accumulate . (accumulating callf2))
84100
(adjoin . (adjoining))
85101
(after-do . (else after else-do))
86102
(append . (appending))
87-
(array . (arraying string stringing across))
88-
(array-ref . ( arraying-ref arrayf arrayingf
89-
stringf stringingf
90-
string-ref stringing-ref
91-
across-ref))
103+
(array . (arraying string stringing))
104+
(array-ref . (arraying-ref string-ref stringing-ref))
92105
(at . (atting))
93106
(before-do . (initially-do initially before))
94107
(collect . (collecting))
95108
(concat . (concating))
96-
(cons . (conses consing on))
109+
(cons . (conses consing))
97110
(count . (counting))
98111
(cycle . (cycling repeat repeating))
99112
(finally-do . (finally))
@@ -103,22 +116,20 @@ Definition must exist. Neither argument need be quoted."
103116
(iter . (iterating))
104117
(leave . (leaving))
105118
(leave-from . (leaving-from))
106-
(list . (listing each in))
107-
(list-ref . (listf listingf listing-ref in-ref))
119+
(list . (listing each))
120+
(list-ref . (listing-ref))
108121
(map . (mapping map-pairs mapping-pairs))
109-
(map-ref . (mapf mappingf mapping-ref))
122+
(map-ref . (mapping-ref))
110123
(max . (maximizing maximize maxing))
111124
;; Unlike "maxing", there doesn't seem to be much on-line about the word
112125
;; "minning", but the double-N follows conventional spelling rules, such as
113126
;; in "sum" and "summing".
114127
(min . (minimizing minimize minning))
115128
(multiply . (multiplying))
116129
(nconc . (nconcing))
117-
(numbers . (num nums number numbering))
118-
(numbers-down . ( nums-down numdown number-down num-down numsdown
119-
numbering-down))
120-
(numbers-up . ( nums-up numup number-up num-up numsup
121-
numbering-up))
130+
(numbers . (number numbering))
131+
(numbers-down . (number-down numbering-down))
132+
(numbers-up . (number-up numbering-up))
122133
(nunion . (nunioning))
123134
(opt-accum . (accum-opt))
124135
(prepend . (prepending))
@@ -128,16 +139,14 @@ Definition must exist. Neither argument need be quoted."
128139
(return-from . (returning-from))
129140
(set . (setting exprs expr))
130141
(set-accum . (setting-accum))
131-
(set-prev . (setting-prev prev prev-expr prev-set))
132-
(seq . (seqing sequence sequencing elements))
133-
(seq-index . ( sequence-index seqing-index sequencing-index
134-
sequencing-index sequencei seqi list-index listing-index
135-
listi array-index arraying-index arrayi
136-
string-index stringing-index stringi))
137-
(seq-ref . ( seqf seqing-ref
138-
sequencef sequencingf sequence-ref
139-
sequencing-ref
140-
elements-ref))
142+
(set-prev . (setting-prev prev-expr prev-set))
143+
(sequence . (sequencing seq seqing))
144+
(sequence-index . ( seq-index seqing-index
145+
sequencing-index
146+
list-index listing-index
147+
array-index arraying-index
148+
string-index stringing-index))
149+
(sequence-ref . (seqing-ref seq-ref sequencing-ref))
141150
(skip . (skipping continue continuing))
142151
(skip-from . (skipping-from continue-from continuing-from))
143152
(stream . (streaming))
@@ -203,9 +212,9 @@ true names and lists of aliases.
203212
(reduce . loopy--parse-reduce-command)
204213
(return . loopy--parse-return-command)
205214
(return-from . loopy--parse-return-from-command)
206-
(seq . loopy--parse-seq-command)
207-
(seq-index . loopy--parse-seq-index-command)
208-
(seq-ref . loopy--parse-seq-ref-command)
215+
(sequence . loopy--parse-seq-command)
216+
(sequence-index . loopy--parse-seq-index-command)
217+
(sequence-ref . loopy--parse-seq-ref-command)
209218
(set . loopy--parse-set-command)
210219
(set-prev . loopy--parse-set-prev-command)
211220
(skip . loopy--parse-skip-command)
@@ -781,6 +790,12 @@ This predicate checks for presence in the list
781790
(when (memq name v)
782791
(cl-return-from loopy--get-true-name k)))
783792
loopy-aliases)
793+
(map-do (lambda (k v)
794+
(when (memq name v)
795+
(warn "`loopy': `%s' is an obsolete built-in alias of `%s'. It will be removed in the future. To add it as a custom alias, use `loopy-defalias'."
796+
name k)
797+
(cl-return-from loopy--get-true-name k)))
798+
loopy--obsolete-aliases)
784799
nil)
785800
name))
786801

0 commit comments

Comments
 (0)