unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Unexpected behavior from 'memq' and 'memv' (guile 1.9.15)
@ 2011-02-07  1:13 Mark Harig
  2011-02-07 21:08 ` Andy Wingo
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Harig @ 2011-02-07  1:13 UTC (permalink / raw)
  To: guile-user

'memq' and 'memv' are not returning sublists as documented if (quote...)
is used to specify the list that is to be searched.  Instead, they are
returning #t.  Is this expected (and undocumented) behavior?

(Note: 'member' returns the found sublist for both (list ...) and 
(quote ...))

$ /usr/local/bin/guile
GNU Guile 1.9.15
Copyright (C) 1995-2010 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> ,d memq
 -- Scheme Procedure: memq x lst
     Return the first sublist of LST whose car is `eq?' to X where the
     sublists of LST are the non-empty lists returned by `(list-tail
     LST K)' for K less than the length of LST.  If X does not occur in
     LST, then `#f' (not the empty list) is returned.

scheme@(guile-user)> (memq 'a (list 'b 'a 'c 'd))
$1 = (a c d)
scheme@(guile-user)> (memq 'a '(b a c d))
$2 = #t

scheme@(guile-user)> ,d memv
 -- Scheme Procedure: memv x lst
     Return the first sublist of LST whose car is `eqv?' to X where the
     sublists of LST are the non-empty lists returned by `(list-tail
     LST K)' for K less than the length of LST.  If X does not occur in
     LST, then `#f' (not the empty list) is returned.

scheme@(guile-user)> (memv 101 (list 103 101 102 104))
$3 = (101 102 104)
scheme@(guile-user)> (memv 101 '(103 101 102 104))
$4 = #t
scheme@(guile-user)>  (version)
$5 = "1.9.15"
scheme@(guile-user)> %load-path
$6 = ("/usr/local/share/guile/2.0" "/usr/local/share/guile/site/2.0"
"/usr/local/share/guile/site" "/usr/local/share/guile")

--



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Unexpected behavior from 'memq' and 'memv' (guile 1.9.15)
  2011-02-07  1:13 Unexpected behavior from 'memq' and 'memv' (guile 1.9.15) Mark Harig
@ 2011-02-07 21:08 ` Andy Wingo
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Wingo @ 2011-02-07 21:08 UTC (permalink / raw)
  To: Mark Harig; +Cc: guile-user

On Mon 07 Feb 2011 02:13, Mark Harig <idirectscm@aim.com> writes:

> 'memq' and 'memv' are not returning sublists as documented if (quote...)
> is used to specify the list that is to be searched.  Instead, they are
> returning #t.  Is this expected (and undocumented) behavior?

Nope, just a bug.  Fixed in git.  Thanks for the report!

In the future, bug-guile is a more appropriate mailing list for bug
reports.  It's OK if you're unsure whether it's a bug or not.

Cheers,

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-07 21:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-07  1:13 Unexpected behavior from 'memq' and 'memv' (guile 1.9.15) Mark Harig
2011-02-07 21:08 ` Andy Wingo

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