[Top][All Lists]

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

bug#25129: 26.0.50; seq-some function

From: Pierre Lorenzon
Subject: bug#25129: 26.0.50; seq-some function
Date: Wed, 07 Dec 2016 09:09:54 +0100 (CET)

Is documentation in following seq-somme function not ambiguous
? One might believe taht it returns the element and not the
test result as it does. Moreover I suspect even if I did not
verify that it was not so in a previous implementation since I
had no error in my code before using seq-some.

I well understand now that I must use seq-find instead of
seq-some but I think that I will not be the only one being
confused by these functions specifications !

In fact there is a very subtle difference between two
documentation : value not equal element .... But what means
value ? Is it obvious taht it means test result ?


>>>  -- Code 

(cl-defgeneric seq-some (pred sequence)
  "Return the first value for which if (PRED element) is non-nil for in 
  (catch 'seq--break
    (seq-doseq (elt sequence)
      (let ((result (funcall pred elt)))
        (when result
          (throw 'seq--break result))))

(cl-defgeneric seq-find (pred sequence &optional default)
  "Return the first element for which (PRED element) is non-nil in SEQUENCE.
If no element is found, return DEFAULT.

Note that `seq-find' has an ambiguity if the found element is
identical to DEFAULT, as it cannot be known if an element was
found or not."
  (catch 'seq--break
    (seq-doseq (elt sequence)
      (when (funcall pred elt)
        (throw 'seq--break elt)))

>>>  -- End Code 

In GNU Emacs (x86_64-unknown-linux-gnu)
 of 2016-11-15 built on jabberwocky
Repository revision: db43613307bb05d0f43d2d5649b5bb2f29876cee
Recent messages:
Mark set
Making completion list...
Type "q" in help window to restore its previous buffer, C-M-v to scroll help.
line-move-visual: End of buffer
mouse-2, RET: find function's definition
uncompressing seq.el.gz...done
Note: file is write protected
Unable to find location in file
Mark saved where search started
Making completion list...

Configured using:
 'configure --prefix=/usr --libdir=/usr/lib64 'CC=gcc -m64'

Configured features:

Important settings:
  value of $LANG: C
  locale-coding-system: nil

Major mode: Emacs-Lisp

Minor modes in effect:
  gpm-mouse-mode: t
  global-ede-mode: t
  ede-minor-mode: t
  desktop-save-mode: t
  global-speechd-speak-mode: t
  speechd-speak-mode: t
  global-speechd-speak-map-mode: t
  speechd-speak-map-mode: t
  tooltip-mode: t
  electric-indent-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:
/usr/local/share/emacs/site-lisp/customization/site-start hides 

(shadow emacsbug sendmail thingatpt eieio-opt
j++-packages-sound-alsa-iec958 j++-packages-sound-alsa-boolean
j++-basic-widgets-synchronized-switch j++-basic-parsers-slot
j++-packages-sound-alsa-item j++-packages-sound-alsa-amixer
j++-interfaces-pointed j++-packages-sound-alsa-cclient
j++-packages-sound-alsa-client j++-basic-parsers-parser
j++-basic-parsers-utils utils/regexp utils/string
j++-basic-synchronized j++-basic-processes-synchronous
j++-basic-processes-command help-fns radix-tree debug vc-cvs
vc-rcs misearch multi-isearch pp qp mew-varsx mew-unix
inversion make-mode ede/srecode compile comint ansi-color
log-edit easy-mmode message rfc822 mml mml-sec epa derived epg
epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader ring pcvs-util add-log
j++-packages-subsystems-descriptors-creator dired-aux
j++-packages-scmel-results j++-packages-scmel-output
speechd-el-extension t-mouse term/linux vc-dir ewoc ede/dired
semantic/lex-spp pln-w3m mew-w3m w3m regexp-opt doc-view dired
dired-loaddefs image-mode timezone w3m-hist w3m-fb bookmark-w3m
w3m-ems w3m-ccl ccl w3m-favicon w3m-image w3m-proc w3m-util
mew-auth mew-config mew-imap2 mew-imap mew-nntp2 mew-nntp
mew-pop mew-smtp mew-ssl mew-ssh mew-net mew-highlight mew-sort
mew-fib mew-ext mew-refile mew-demo mew-attach mew-draft
mew-message mew-thread mew-virtual mew-summary4 mew-summary3
mew-summary2 mew-summary mew-search mew-pick mew-passwd
mew-scan mew-syntax mew-bq mew-smime mew-pgp mew-header
mew-exec mew-mark mew-mime mew-edit mew-decode mew-encode
mew-cache mew-minibuf mew-complete mew-addrbook mew-local
mew-vars3 mew-vars2 mew-vars mew-env mew-mule3 mew-mule
mew-gemacs mew-key mew-func mew-blvs mew-const mew pln-mew
pln-eww url-file url-dired eww mm-url gnus nnheader gnus-util
rmail tool-bar rmail-loaddefs rfc2047 rfc2045 ietf-drums
mail-utils mm-util mail-prsvr url-queue url url-proxy
url-privacy url-history url-cookie url-domsuf mailcap shr svg
xml dom browse-url format-spec url-expand url-util url-methods
url-parse url-vars Tss-TeX-remap tex-style-system tex-site
auto-loads j++-packages-databases-actions
j++-packages-databases-items-item j++-basic-mastered
j++-basic-widgets-open-close-title j++-basic-widgets-title
j++-packages-databases-database j++-packages-databases-mutable
j++-basic-widgets-lists-pointed j++-basic-lists-pointed
j++-basic-creator j++-interfaces-loadable-basic-lists-list
j++-interfaces-basic-lists-list j++-basic-widgets-lists-list
j++-basic-lists-list j++-basic-mapable j++-basic-sortable
j++-project j++-packages-project-project j++-basic-files-file
edext-project-latex edext-project-project edext-utils-vc vc-svn
vc vc-dispatcher edext-target-exercise edext-target-history
edext-target-student edext-target-latex edext edext-automake
edext-srecode semantic/edit srecode/srt-mode semantic/analyze
semantic/sort semantic/scope semantic/analyze/fcn semantic/db
semantic/format srecode/template srecode/srt-wy semantic/wisent
semantic/wisent/wisent semantic/ctxt edext-compat pln-ede
srecode/insert srecode/filters srecode/args srecode/find
srecode/map srecode/ctxt semantic/tag-ls semantic/find
srecode/compile srecode/dictionary srecode/table srecode
semantic/util-modes semantic/util semantic semantic/tag
semantic/lex semantic/fw mode-local find-func ede/proj-elisp
ede/pconf ede/proj-misc ede/proj-shared ede/proj-prog ede/pmake
ede/proj-obj ede/proj ede/make ede/proj-comp ede/autoconf-edit
autoconf autoconf-mode pln-auctex pln-customization
ede/speedbar ede/files ede ede/detect ede/base ede/auto
ede/source eieio-speedbar speedbar sb-image ezimage image
dframe cedet desktop frameset cus-start cus-load time-date
j++-packages-scmel-efm-connection network-stream puny nsm
subr-x auth-source password-cache starttls tls gnutls
j++-packages-scmel-efm-driver j++-packages-scmel-efm-efm
j++-packages-scmel-monitor j++-packages-scmel-scmel
j++-basic-logger j++-basic-processes-network-filtered
j++-basic-processes-filtered j++-basic-processes-put-and-get
j++-basic-processes-network-stream j++-basic-processes-process
j++-interfaces-loadable-loadable j++-interfaces-interface
j++-basic-widgets-object warnings j++-basic-files-loadable
j++-basic-state j++-basic-files-serializable
j++-basic-files-stringifiable j++-basic-files-load eieio-base
eieio-custom wid-edit speechd-speak advice speechd-brltty
speechd-braille braille mmanager brltty speechd-ssip speechd
speechd-out eieio-compat cl-seq speechd-common jka-compr j++
j++-compat j++-precompat eieio eieio-core cl-macs
eieio-loaddefs seq byte-opt bytecomp byte-compile cl-extra
help-mode easymenu cconv cl gv cl-loaddefs pcase cl-lib
mule-util disp-table tooltip eldoc electric uniquify ediff-hook
vc-hooks lisp-float-type tabulated-list newcomment elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame 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 charscript case-table epa-hook
jka-cmpr-hook help simple abbrev obarray minibuffer
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 inotify multi-tty make-network-process emacs)

Memory information:
((conses 16 402793 68817)
 (symbols 48 40865 109)
 (miscs 40 1386 237)
 (strings 32 90674 7379)
 (string-bytes 1 2616687)
 (vectors 16 45189)
 (vector-slots 8 963465 20687)
 (floats 8 1962 250)
 (intervals 56 8907 541)
 (buffers 976 76)
 (heap 1024 45549 1348))

reply via email to

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