[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Unexpected behavior from 'memq' and 'memv' (guile 1.9.15)
From: |
Mark Harig |
Subject: |
Unexpected behavior from 'memq' and 'memv' (guile 1.9.15) |
Date: |
Sun, 06 Feb 2011 20:13:16 -0500 |
'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")
--
- Unexpected behavior from 'memq' and 'memv' (guile 1.9.15),
Mark Harig <=