bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#43995: 27.1; Argument orderd in function parameter of seq-reduce


From: Nathan Benedetto Proença
Subject: bug#43995: 27.1; Argument orderd in function parameter of seq-reduce
Date: Wed, 14 Oct 2020 15:54:54 -0300


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))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]