PPT Slide
1.40
SEARCHING FOR A VALUE
IN A LIST
( defun isin ( val L )
( cond
( ( null L ) NIL )
( ( eql val ( car L ) ) T )
( T ( isin val ( cdr L ) ) )
) )
( isin 8 ’( 6 2 3 4 1 31 ) )
( isin 8 ’( 2 3 4 8 1 31 ) )
( isin 8 ’( 3 4 8 1 31 ) )
( isin 8 ’( 4 8 1 31 ) )
( isin 8 ’( 8 1 31 ) )
T
Previous slide
Next slide
Back to first slide
View graphic version