# [plt-scheme] HTDPExercise 14.1.3

 From: aditya shukla (adityashukla1983 at gmail.com) Date: Wed Jun 10 16:47:58 EDT 2009 Previous message: [plt-scheme] lc-with-redex update Next message: [plt-scheme] HTDPExercise 14.1.3 Messages sorted by: [date] [thread] [subject] [author]

```I was solving  this exercise from htdp , its been quite some days since i
wrote a program in scheme .I am getting this error which i am not able to

;data definition
(define-struct child (father mother name date eyes))
;oldest generation
(define Carl (make-child empty empty 'Carl 1926 'green))
(define Bettina (make-child empty empty 'Bettina 1926 'green))

;; Middle Generation:
(define Dave (make-child Carl Bettina 'Dave 1955 'black))
(define Eva (make-child Carl Bettina 'Eva 1965 'blue))
(define Fred (make-child empty empty 'Fred 1966 'pink))

;; Youngest Generation:
(define Gustav (make-child Fred Eva 'Gustav 1988 'brown))

;A family-tree-node (short: ftn) is either

;  1.

;  empty; or
;2.

;  (make-child f m na da ec)
; where f and m are ftns, na
;and ec are symbols, and da is a number.
;contract of count-persons ftn(family tree node) -> number
;Purpose :This function takes a family tree node and computes the number of
persons in that node
;examples empty -> 0 ,carl ->1 , bettina -> 1 ,  adam , dave , eva -> 3 ,
fred->1 , gustav-> 5
;template(define count-persons (lambda (ftn) (cond [(empty? ftn )][else
(count-persons (child-father ftn)) (count-persons (child-mother  ftn))
(child-name ftn) (child-date ftn) (child-eyes ftn)])))
(define (count-persons  a-ftree)
(cond
[(empty? a-ftree) 0]
[else ((symbol? (child-name a-ftree))  (+ 1 (count-persons(or (child?
(child-father a-ftree) ) (child? (child-mother a-ftree) )))))]))

(count-persons Fred)

function call: expected a name after an open parenthesis, but found
something else

Thanks,