|
SketchyLISP Reference |
Copyright (C) 2007 Nils M Holm |
| <<[gcd] | [Index] | [id]>> |
Conformance: SketchyLISP Extension
Purpose: Check whether an expression is the head of another.
Arguments:
X - potential head
Y - expression
Implementation:
(define (head? x y)
(cond ((null? y) (null? x))
((null? x) #t)
((equal? (car x) (car y))
(head? (cdr x) (cdr y)))
(else #f)))
Example:
(head? '(a b c) '(a b c d e f)) => #t
| <<[gcd] | [Index] | [id]>> |