[racket] A list of vectors

From: Everett Morse (webj2 at unoc.net)
Date: Mon Oct 18 18:57:13 EDT 2010

Update to my previous post, I missed a ` character (just ran it to make 
sure I was sane).  The line is actually:

(list `#(,(regexp-replace* a-string (vector-ref (first T) 0) 
(string-append "<<" a-string ">>")))))

Thanks,
-Everett

On 10/18/2010 03:23 PM, scouic wrote:
> Hi all,
> here more than three hours that i'm locked on a function, i defer to 
> you =)
> My problem : i have a list of vectors, each vectors represents a text 
> syntax (not html syntax, just text), and were created with the result 
> of a format sqlite SELECT operation.
>
> For example, my list of vectors L is like this :
> (define L '(#("nickname || ' ( ' || date || ' )' || content")
>             #("zobi ( Thursday, October 14th, 2010 12:40:51pm ) 
> <p>try</p>")
>             #("zf ( Thursday, October 14th, 2010 12:43:56pm ) (a 
> ((href \"foo.html\")) \"sometext\")")
>             #("zf2 ( Thursday, October 14th, 2010 12:44:59pm ) (a 
> ((href \"bar.html\")) \"anotherone\")")))
>
> So, (first L) is a vector, (second L) too, etc.
> Now, i want to replace each string, for example "Thursday", by 
> "<<Thursday>>", in my list of vectors.
>
> I have created a function, wich i call like this :
> (rush! L  '() "Thursday")
>
> this is the function :
> (define (rush! T super-list a-string)
>   (if (empty? T)
>       super-list ;; here is the problem
>       (rush! (rest T)
>                  (append
>                   super-list
>                   (list (regexp-replace* a-string (vector-ref (first 
> T) 0) (string-append "<<" a-string ">>"))))
>                  a-string)))
>
> Now, if i compare L and (rush! L '() "Thursday"), i have for L:
> '(#("nickname || ' ( ' || date || ' )' || content")
>   #("zobi ( Thursday, October 14th, 2010 12:40:51pm ) <p>try</p>")
>   #("zf ( Thursday, October 14th, 2010 12:43:56pm ) (a ((href 
> \"foo.html\")) \"sometext\")")
>   #("zf2 ( Thursday, October 14th, 2010 12:44:59pm ) (a ((href 
> \"bar.html\")) \"anotherone\")"))
>
> and for the function :
> '("zobi ( <<Thursday>>, October 14th, 2010 12:40:51pm ) <p>try</p>"
>   "zf ( <<Thursday>>, October 14th, 2010 12:43:56pm ) (a ((href 
> \"foo.html\")) \"sometext\")"
>   "zf2 ( <<Thursday>>, October 14th, 2010 12:44:59pm ) (a ((href 
> \"bar.html\")) \"anotherone\")")
>
> BUT it's not a list of vectors, it's a simple list ...
> Instead of
> (if (empty? T)  super-list ...
> i've tried (if (empty? T) (list->vector super-list) ... mamamia, it's 
> no a list of vectors, but just a simple vector ...
>
> I really don't know how i can replace a-string into a list of vectors 
> so, because my rush! function doesn't works like i want ...
>
> Thank you for your help,
> -mw
>
>
> _________________________________________________
>    For list-related administrative tasks:
>    http://lists.racket-lang.org/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101018/050cdb2f/attachment.html>

Posted on the users mailing list.