Link to home
Start Free TrialLog in
Avatar of TechLearnerCA
TechLearnerCA

asked on

Trying to count number of variables in Scheme list

This is the code I have so far, I am trying to implement code from a previous question.
This is the error I am getting, procedure application: expected procedure, given: 1 (no arguments)
I don't think my counter is correct.

(define (countrepeat lst)
  
  (count((1) (lst)))

    )

(define (count s lst)
  (cond
    
    ((null? list) '())
    ((null? (cdr lst)) '())
    
   
    
    ((equal? (car lst)(car(cdr lst))) (count(+1 cdr lst)))
    
    (else (list s(list(car lst))))
    ))

Open in new window

Avatar of TommySzalapski
TommySzalapski
Flag of United States of America image

Shouldn't it be count(s+1 cdr lst) on line 15?
Your else looks really weird too. Don't you just want to call  count(1 cdr lst) ?
ASKER CERTIFIED SOLUTION
Avatar of F. Dominicus
F. Dominicus
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.