[REBOL] Re: Compose words to get content
From: compkarori::gmail::com at: 5-Sep-2005 21:29
Hi Thorsten
I didn't take the time to explain what was going wrong.
I think you were trying this ...
>> reduce [ join "cells/" "3" ]
== ["cells/3"]
but reduce just evaluates that expression, and returns a string.
To evaluate the string as source code as you appeared to want, you
have to 'do it
reduce [ do join "cells/" "3" ]
I just chose an alternate way of achieving the same end.
On 9/5/05, Thorsten Moeller <[tmoeller--fastmail--fm]> wrote:
> Hi Graham,
>
> thanks for your immediate help. It works as i need it. Thats the way i
> was searching for the whole yesterday evening. Perhaps it was to late
> and i do not have "pick" coming to my mind.
>
> Thanks
>
> Thorsten
>
> On Mon, 5 Sep 2005 20:34:09 +1200, "Graham Chiu" <[compkarori--gmail--com]>
> said:
> >
> > Hi Thorsten
> >
> > Will this work for you?
> >
> > foreach line sourcefile [
> > cells: parse/all line ","
> > foreach mline map [
> > write/append join tpath mline/1
> > rejoin [ pick cells to-integer mline/2 pick cells to-integer
> > mline/3 " " mline/4 " " newline ]
> > ]
> > ]
> >
> >
> > On 9/5/05, Thorsten Moeller <[tmoeller--fastmail--fm]> wrote:
> > >
> > > Hi,
> > >
> > > i made a small script to split a file. I use a series containing the
> > > rules how every row in the source should be splitted. The problem i have
> > > is when i want to compose the new lines from the rules. A little example
> > > should make it more clear:
> > >
> > > sourcefile: read/lines %/c/temp/sourcefile.txt
> > > tpath: %/c/temp/
> > >
> > > map: [ ["filename1.txt" "1" "8" "q"]
> > > ["filename2.txt" "1" "11" "m"]
> > > ["filename3.txt" "1" "27" "m"]
> > > ["filename4.txt" "1" "17" "q"]
> > > ]
> > >
> > > foreach line sourcefile[
> > > cells: parse/all line ","
> > > foreach mline map [ write/append join tpath mline/1 reduce [join
> > > "cells/" mline/2 join " cells/" mline/3 " " mline/4 " " newline ]];
> > > -- Problem
> > > ]
> > >
> >
> > --
> > Graham Chiu
> > --
> > To unsubscribe from the list, just send an email to
> > lists at rebol.com with unsubscribe as the subject.
> >
>
> --
> http://www.fastmail.fm - A no graphics, no pop-ups email service
>
> --
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
>
--
Graham Chiu