[racket] please help to change vector to list

From: Jos Koot (jos.koot at telefonica.net)
Date: Thu Jun 2 07:10:08 EDT 2011

Whast you describe seems correct.
How about showing me yoyur code after deleting vector->list?
 
If this is HOMEWORK, send it OFF LIST.
 
What language did you use?
 
Jos


  _____  

From: users-bounces at racket-lang.org [mailto:users-bounces at racket-lang.org]
On Behalf Of Yingjian Ma
Sent: 02 June 2011 08:45
To: users at racket-lang.org
Subject: [racket] please help to change vector to list


Hi ALL,
 
I have this code
 
(define test    
  (lambda (x v)     
    (define helper       
      (lambda (ls)         
        (cond           
          ((empty? ls) '())          
          ((empty? (rest ls)) '())          
          ((equal? (second ls) x) (cons (first ls) (helper (rest ls))))

          (else (helper (rest ls))))))    
   (helper (vector->list v)))) 
 
When I run it with 
> (test 'a #(b a c a))
it returns
'(b c)
 
Is there a way to use the list such as (test 'a '(b a c a))?  I tried to
delete vector->list from the last line of the code, but it did not work.
Why?
 
Thanks a lot

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110602/73e61b90/attachment.html>

Posted on the users mailing list.