member -- r7rs Definition procedure;
Procedure variants:
((any null) -> (false))
((any list-not-null) -> (list-not-null-or-false))
any;list-not-null;list-not-null-or-false;((any null procedure-2) -> (false))
any;null;procedure-2;false;((any list-not-null procedure-2) -> (list-not-null-or-false))
any;list-not-null;procedure-2;list-not-null-or-false;scheme:base -- (scheme base);scheme -- (scheme);(memq obj list) (memv obj list) (member obj list) (member obj list compare)These procedures return the first sublist of
listwhose car isobj, where the sublists oflistare the non-empty lists returned by(list-tail list k)forkless than the length oflist. Ifobjdoes not occur inlist, then#f(not the empty list) is returned. Thememqprocedure useseq?to compareobjwith the elements oflist, whilememvuseseqv?andmemberusescompare, if given, andequal?otherwise.(memq 'a '(a b c)) ===> (a b c) (memq 'b '(a b c)) ===> (b c) (memq 'a '(b c d)) ===> #f (memq (list 'a) '(b (a) c)) ===> #f (member (list 'a) '(b (a) c)) ===> ((a) c) (member "B" '("a" "b" "c") string-ci=?) ===> ("b" "c") (memq 101 '(100 101 102)) ===> #unspecified (memv 101 '(100 101 102)) ===> (101 102)
The text herein was sourced and adapted as described in the "R7RS attribution of various text snippets" appendix.