From: "Nathan Benedetto Proença" <nathan@vieiraproenca.com>
To: 43995@debbugs.gnu.org
Subject: bug#43995: 27.1; Argument orderd in function parameter of seq-reduce
Date: Wed, 14 Oct 2020 15:54:54 -0300 [thread overview]
Message-ID: <87zh4owsch.fsf@archlinux.i-did-not-set--mail-host-address--so-tickle-me> (raw)
Good afternoon!
This is not a bug per se, but I was directed here by
https://github.com/NicolasPetton/seq.el
I want to know if there is any guarantee regarding the order of
parameters passed to the FUNCTION argument in seq-reduce.
'C-h f seq-reduce RET' tells me that:
> seq-reduce is an autoloaded compiled Lisp function in ‘seq.el’.
>
> (seq-reduce FUNCTION SEQUENCE INITIAL-VALUE)
>
> Reduce the function FUNCTION across SEQUENCE, starting with INITIAL-VALUE.
>
> Return the result of calling FUNCTION with INITIAL-VALUE and the
> first element of SEQUENCE, then calling FUNCTION with that result and
> the second element of SEQUENCE, then with that result and the third
> element of SEQUENCE, etc.
>
> If SEQUENCE is empty, return INITIAL-VALUE and FUNCTION is not called.
The wording gave me the impression that the first argument of FUNCTION
is the accumulator, and the second is the element of the SEQUENCE, but I
was not sure.
By inspecting the code, I saw that this was indeed the case.
This mattered because I had a closure as an accumulator, and wanted to
update this closure by iterating over a list whose elements where not
closures.
The example in the Elisp book
https://www.gnu.org/software/emacs/manual/html_node/elisp/Sequence-Functions.html#Sequence-Functions
uses addition, in which this issue does not arise.
If it is a good idea, I could update the docstring and the manual, but I
would need some pointers on how to do it.
Thanks in advance!
Nathan
In GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.22, cairo version 1.17.3)
of 2020-08-28 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.12009000
System Description: Arch Linux
Recent messages:
Making completion list...
Type "q" in help window to restore its previous buffer.
Auto-saving...
mouse-2, RET: find function's definition
Mark set
completing-read-default: Command attempted to use minibuffer while in minibuffer
Quit
Making completion list... [3 times]
Making completion list...
Configured using:
'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
--localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-wide-int
--with-modules --with-cairo --with-harfbuzz 'CFLAGS=-march=x86-64
-mtune=generic -O2 -pipe -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2
LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'
Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON
PDUMPER LCMS2 GMP
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Help
Minor modes in effect:
global-magit-file-mode: t
magit-auto-revert-mode: t
global-git-commit-mode: t
async-bytecomp-package-mode: t
show-paren-mode: t
shell-dirtrack-mode: t
TeX-PDF-mode: t
delete-selection-mode: t
electric-pair-mode: t
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr reporter emacsbug sendmail magit-extras
face-remap magit-submodule magit-obsolete magit-blame magit-stash
magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
which-func imenu magit-diff smerge-mode diff magit-core magit-autorevert
autorevert filenotify magit-margin magit-transient magit-process
magit-mode git-commit transient magit-git magit-section magit-utils
log-edit pcvs-util add-log with-editor async-bytecomp async pcmpl-unix
em-unix em-term term disp-table ehelp em-script em-prompt em-ls em-hist
em-pred em-glob em-dirs esh-var em-cmpl em-basic em-banner em-alias
esh-mode conf-mode vc-git flyspell ispell org-element avl-tree generator
ol-eww ol-rmail ol-mhe ol-irc ol-info ol-gnus nnir gnus-sum url
url-proxy url-privacy url-expand url-methods url-history gnus-group
gnus-undo gnus-start gnus-cloud nnimap nnmail mail-source utf7 netrc
nnoo parse-time iso8601 gnus-spec gnus-int gnus-range gnus-win gnus
nnheader ol-docview doc-view image-mode exif ol-bibtex bibtex ol-bbdb
ol-w3m macros jka-compr misearch multi-isearch eieio-opt cl-extra
speedbar sb-image ezimage dframe help-fns radix-tree help-mode shr-color
color shr url-cookie url-domsuf url-util svg dom mule-util pp server
paren paredit ffap ob-ruby ob-shell shell ob-eshell eshell esh-cmd
esh-ext esh-opt esh-proc esh-io esh-arg esh-module esh-groups esh-util
the-org-mode-expansions org ob ob-tangle ob-ref ob-lob ob-table ob-exp
org-macro org-footnote org-src ob-comint org-pcomplete pcomplete
org-list org-faces org-entities noutline outline org-version
ob-emacs-lisp ob-core ob-eval org-table ol org-keys org-compat org-macs
org-loaddefs find-func notmuch hl-line notmuch-tree notmuch-jump
notmuch-hello wid-edit notmuch-show notmuch-print notmuch-crypto
notmuch-mua notmuch-message notmuch-draft notmuch-maildir-fcc
notmuch-address notmuch-company notmuch-parser notmuch-wash diff-mode
coolj notmuch-query goto-addr icalendar diary-lib diary-loaddefs
cal-menu calendar cal-loaddefs notmuch-tag notmuch-lib notmuch-version
notmuch-compat message rmc puny dired dired-loaddefs format-spec rfc822
mml mailabbrev gmm-utils mailheader mm-view mml-smime mml-sec epa
derived epg epg-config gnus-util rmail rmail-loaddefs mail-utils
text-property-search time-date smime dig mm-decode mm-bodies mm-encode
mailcap mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr
rx font-latex reftex reftex-loaddefs reftex-vars auctex-latexmk tex-buf
latex-mode-expansions latex easy-mmode latex-flymake flymake-proc
flymake compile comint ansi-color ring warnings tex-ispell tex-style tex
dbus xml crm texmathp delsel expand-region text-mode-expansions
er-basic-expansions thingatpt expand-region-core advice
expand-region-custom elec-pair edmacro kmacro gruvbox-dark-hard-theme
gruvbox autothemer dash finder-inf tex-site info package easymenu
browse-url url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq
byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win
x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit
x multi-tty make-network-process emacs)
Memory information:
((conses 16 510123 116089)
(symbols 48 38222 1)
(strings 32 166206 24816)
(string-bytes 1 4963351)
(vectors 16 63944)
(vector-slots 8 1315342 52348)
(floats 8 454 397)
(intervals 56 8162 891)
(buffers 1000 36))
next reply other threads:[~2020-10-14 18:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-14 18:54 Nathan Benedetto Proença [this message]
2020-10-15 7:38 ` bug#43995: 27.1; Argument orderd in function parameter of seq-reduce Lars Ingebrigtsen
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=87zh4owsch.fsf@archlinux.i-did-not-set--mail-host-address--so-tickle-me \
--to=nathan@vieiraproenca.com \
--cc=43995@debbugs.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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).