Higher order functions will be what you are looking for. In this case - map and vector-map.
http://docs.racket-lang.org/reference/pairs.html#(def._((lib._racket/private/map..rkt)._map)) http://docs.racket-lang.org/reference/vectors.html#(def._((lib._racket/vector..rkt)._vector-map)) Use map to iterate over the list of vectors, then use vector-map to iterate over the cells within the vectors to apply the regexp-replace* function. (map (lambda (vector) (vector-map (lambda (cell) <apply_proc_to_individual_cell ...>) vector)) <your_list_of_vectors>) HTH. Cheers, yc On Mon, Oct 18, 2010 at 2:23 PM, scouic <sco...@gmail.com> 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 > -- Cheers, yc Taming the software dragon - http://dragonmaestro.com
_________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users