In this case Power (^:) is used to control iteration.

You can read about the remarkable powers of Power (pun intended) in the 
J Dictionary Vocabulary entry for ^: .

On 2012/01/08 09:50 , Tom Szczesny wrote:
> I used the debug utilities described in the Primer to better understand
> cutl
>      load  'debug'
>      dbss 'cutl *:*'
>      dbr 1
>      csvfile=: 1!:1<'test.csv'
>
>        csvfile
> a,tkr,dt,s,td,l,cd,qu,pr,val,cst,ty,lgl,sgl,iq,iu,ix,qc,qp,st,dte,cq,qv,cmt
> m,bac,2003/09/26,18,,b,v,,,240,,2003,,,240,,,,,,,33,300,
> m,bac,2004/04/01,21,,a,xr,444,,,-20184,,,,,,,,,,,42,,fbf
> m,bac,2004/04/21,22,,a,lu,,,19.49,,2004,19.49,,,,,,,,,42,,
> m,bac,2005/03/28,38,,a,v,,,39.6,,2005,,,39.6,,,,,,,51,88,
> m,bk,2003/03/20,42,,a,fr,2000,12.37,-24750,-24750,2004,,,,,,,,,,31,,
> m,bk,2003/03/20,43,,b,fr,6761,23.03,-155714.28,-155714.28,2003,,,,,,,,,,31,,acq
> 9/12/97
> m,bk,2003/04/03,52,,f,s,-2600,20.65,53688.64,16900,2003,36788.64,,,,,,,,,32,,
>
>        $csvfile
> 542
>
>      ','&cutl;._2 csvfile
>
> I was amazed that  cutl  loops through csvfile one 'record' at a time,
> as none of the 9 control structure patterns listed in the Primer were
> evident.
>
>
>
> On Mon, Jan 2, 2012 at 12:44 PM, Joey K Tuttle<[email protected]>  wrote:
>
>> I believe that there are a collection of csv related utilities in addons
>> ( require 'csv' will make those available to you).
>>
>> However, for years I have used a simplistic verb to bring .csv files
>> into a j session as a table of enclosed values -
>>
>>     cutl =: 3 : 0
>> :
>>   y =. y,x
>>   q =. y e.'"'
>>   qs =. ~:/\q
>>   }.^: ('"'&=@([:{.1:{.]))&.>  (qs<y e.x)<;._2&((q<:qs)&#) y
>> )
>>
>>     tablecsv =: 3 : 0
>>      ',' tablecsv y   NB. allows choosing an alternative delimiter
>> :
>>      x&cutl;._2 y
>> )
>>
>>
>> On 2012/01/02 09:22 , Tom Szczesny wrote:
>>> Some languages, like q, have a built-in command for reading, parsing, and
>>> loading data from csv files:
>>>      t: ("SSDIDSSIFFFIS";enlist ",")  0: `:/home/tom/t.csv
>>>
>>> Other languages, like a+, do not, and the user needs to write a function
>> to
>>> read, parse and load data from csv files.
>>>
>>>>  From a cursory review, it appears that j is in the a+ camp.
>>> Please confirm that such a facility does not exist in j, before I start
>>> writing my own.
>>>

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to