We help IT Professionals succeed at work.

Trying to count number of variables in Scheme list

Medium Priority
508 Views
Last Modified: 2012-06-27
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

Comment
Watch Question

CERTIFIED EXPERT
Awarded 2010
Top Expert 2013

Commented:
Shouldn't it be count(s+1 cdr lst) on line 15?
CERTIFIED EXPERT
Awarded 2010
Top Expert 2013

Commented:
Your else looks really weird too. Don't you just want to call  count(1 cdr lst) ?
CEO/Programmer
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Dirk HaestProject manager
CERTIFIED EXPERT

Commented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.