|
There were a lot of right solutions. Here are my versions:
(define (length_invlist il)
(sum (map (lambda (s) (nbr_appearances_invlist s il))
(members_invlist il))))
(define (prefix_list? list1 list2)
(cond ((null? list1)
#t)
(null? list2)
#f)
(eq? (car list1) (car list2))
(prefix_list? (cdr list1) (cdr list2)))
(else
#f)))
(define (longand boollist)
(cond ((null? boollist) #t)
((car boollist) (longand (cdr boollist))
(else #f)))
(define (prefix_invlist? il1 il2)
(longand
(map (lambda (s) (prefix_list?
(locations_invlist s il1)
(locations_invlist s il2)))
(members_invlist il1))))
How many mistakes did I make?
Mike O'D.
|