core: Add member.
* src/lib.c (member): New function. * module/mes/scm.mes (member): Remove.
This commit is contained in:
parent
5e9c539f57
commit
f33d23bca1
|
@ -126,11 +126,6 @@
|
|||
|
||||
(define memv memq)
|
||||
|
||||
(define (member x lst)
|
||||
(if (null? lst) #f
|
||||
(if (equal? x (car lst)) lst
|
||||
(member x (cdr lst)))))
|
||||
|
||||
|
||||
;;; Lists
|
||||
(define (make-list n . x)
|
||||
|
|
18
src/lib.c
18
src/lib.c
|
@ -312,3 +312,21 @@ equal2_p (SCM a, SCM b)
|
|||
}
|
||||
return eq_p (a, b);
|
||||
}
|
||||
|
||||
SCM
|
||||
member (SCM x, SCM a)
|
||||
{
|
||||
switch (TYPE (x))
|
||||
{
|
||||
case TCHAR:
|
||||
case TNUMBER:
|
||||
case TKEYWORD:
|
||||
case TSYMBOL:
|
||||
case TSPECIAL:
|
||||
return memq (x, a);
|
||||
default:
|
||||
while (a != cell_nil && equal2_p (x, CAR (a)) != cell_t)
|
||||
a = CDR (a);
|
||||
}
|
||||
return a != cell_nil ? a : cell_f;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue