Re: [Jprogramming] path variable in loop

2012-09-11 Thread Raul Miller
Several kinds of issues intersect here. One issue is of course the existing implementations of J. As we have seen, the implementation for imposing rank on a verb involves sequential processing. One issue is machine architecture. Historically, J has been implemented on a CPU architecture -- it's d

Re: [Jprogramming] path variable in loop

2012-09-11 Thread pascha
You were right It was my misunderstanding.. Done! Raul Miller-4 wrote: > > On Tue, Sep 11, 2012 at 12:50 PM, pascha wrote: >> Thanks.. "row_number" works >> But now the problem is I want the verb to iterate over one array at a >> time. >> for example if I do proccess"0(1+i.2) the resultant inp

Re: [Jprogramming] path variable in loop

2012-09-11 Thread Devon McCormick
An interesting and potentially useful ambiguity here is that process"0 (1+i.2) conceptually (as I understand it) processes the two arguments simultaneously but actually processes them serially as it is written in Raul's example. One reason this is interesting is that you could write "process"

Re: [Jprogramming] path variable in loop

2012-09-11 Thread bob therriault
Hi Pascha, If you haven't looked at Henry Rich's 'J for C Programmers', specifically Chapter 5 http://www.jsoftware.com/help/jforc/declarations.htm#_Toc191734319 and Chapter 6 http://www.jsoftware.com/help/jforc/loopless_code_i_verbs_have_r.htm#_Toc191734331 I think that is an excellent start

Re: [Jprogramming] path variable in loop

2012-09-11 Thread Raul Miller
On Tue, Sep 11, 2012 at 12:50 PM, pascha wrote: > Thanks.. "row_number" works > But now the problem is I want the verb to iterate over one array at a time. > for example if I do proccess"0(1+i.2) the resultant input is: > > /home/user/input/filename1.pgm > /home/user/input/filename2.pgm Not exact

Re: [Jprogramming] path variable in loop

2012-09-11 Thread pascha
Thanks.. "row_number" works But now the problem is I want the verb to iterate over one array at a time. for example if I do proccess"0(1+i.2) the resultant input is: /home/user/input/filename1.pgm /home/user/input/filename2.pgm what I want is to "separately" process each array. In the first iter

Re: [Jprogramming] path variable in loop

2012-09-11 Thread pascha
Right, the main problem for me is I've troubles to understand iteration of verbs over array dimension any suggestion for tutorial? aks_sba wrote: > > Pascha, > > The people who have been responding are trying to help you understand the > "j way" to get your problem addressed. In other words, t

Re: [Jprogramming] path variable in loop

2012-09-11 Thread Raul Miller
If I understand what you wrote, you want something like this: require'files' process=: 3 :0 row_number=. ":y input=: fread '/home/user/input/filename', row_number ,'.pgm' NB. insert here, some calculations which define output as a sequence of characters assert. 1=#$output assert. ' ' =

Re: [Jprogramming] path variable in loop

2012-09-10 Thread Devon McCormick
The reason I mention triples is because each argument consists of an input directory, an output directory, and a table. The example arguments show two of each to give you two triplets. On Mon, Sep 10, 2012 at 4:34 PM, pascha wrote: > > If I understood correctly you've included two 'inputd' and t

Re: [Jprogramming] path variable in loop

2012-09-10 Thread Devon McCormick
'\in1';'\in2' is a list of two input directories; '\out1';'\out2' are two output directories. On Mon, Sep 10, 2012 at 4:34 PM, pascha wrote: > > If I understood correctly you've included two 'inputd' and two 'outputd' and > a table which makes it rather complicated for me. If that is right could

Re: [Jprogramming] path variable in loop

2012-09-10 Thread Alan Stebbens
Pascha, The people who have been responding are trying to help you understand the "j way" to get your problem addressed. In other words, they have been showing you how to solve the problem using "loop less" J sentences. In order for you to really understand these helpful suggestions, you have t

Re: [Jprogramming] path variable in loop

2012-09-10 Thread pascha
could I put it into simple form: I'd like to write a verb that reads and process "each" row of a table (50 x 8) with the condition that this verb calls for two other verbs (read and write) which they need a specific path. The problem is that how can I read this table row by row and number the pat

Re: [Jprogramming] path variable in loop

2012-09-10 Thread Ric Sherlock
I'm struggling to understand exactly what you are trying to achieve but am assuming it just involves processing a set of files. If so then something like this might work. Create a 2 column table of outfilenames ,. infilenames. It doesn't really matter how you do this but for clarity here's an exam

Re: [Jprogramming] path variable in loop

2012-09-10 Thread pascha
Yes, you're right. I said "one by one" cause I suppose the limitation doing so. I get the so-called "limit error", (overly large resultant). That's why I turned back to one-by-one manner. I am sure that you would find another strategy to do so but that's the only way I can think of for the moment.

Re: [Jprogramming] path variable in loop

2012-09-10 Thread pascha
If I understood correctly you've included two 'inputd' and two 'outputd' and a table which makes it rather complicated for me. If that is right could you make it for one 'inputd' and one 'outputd' and a table? if I am worng what are 'in1','in2' and 'out1' and 'out2'? Devon McCormick wrote: > >

Re: [Jprogramming] path variable in loop

2012-09-10 Thread Raul Miller
Well... J does have control structures, though only in explicit verbs (and explicit adverbs and explicit conjunctions): http://www.jsoftware.com/help/dictionary/ctrl.htm That said, when you say "one by one" it's usually a good idea to say why you want to do things that way. "One by one" processin

Re: [Jprogramming] path variable in loop

2012-09-10 Thread Devon McCormick
Here are a couple of ways to do what you want. Each of these expects a triplet (input dir; output dir; table) and an arbitrary verb to apply. workOnDirs=: 1 : 0 'inpd outpd table'=. y table u inpd;outpd NB.EG foo workOnDirs &.> ('\in1';'\in2');&.>('\out1';'\out2');&.>tables ) So, the input

Re: [Jprogramming] path variable in loop

2012-09-10 Thread pascha
I am quite unfamiliar with the concept of loop in J. what I meant about loop was the traditional "for loop" as in other languages, I even don't know if such a thing exists I'd like to apply two path variables (one for reading and one for writing) and one other table (these 3 have the array size)

Re: [Jprogramming] path variable in loop

2012-09-10 Thread Raul Miller
Here are your 50 paths: paths=: ('/home/user/file', ":, '.pgm'&[)&.> 1+i.50 If you have a verb which reads one file and processes it, and returns that result, you might use either: averb each paths or averb"0 paths The first version gives your verb an unboxed file name, the second versi

[Jprogramming] path variable in loop

2012-09-10 Thread pascha
I want to include path variable for a verb which reads several files in a loop as an example: path = '/home/user/file' x=: read path,i,'.pgm' in which "read" is the verb, "i" starts from 1 to 50 and '.pgm' is the file extension. so in each iteration "i" would replace with number 1-50. is this