For explicitly defined verbs/functions yes they'll need to be
reinterpreted for each record. I think I'm right in saying that if the
verb/function is tacitly defined then that is not the case (someone
correct me if I'm wrong!).

On Mon, Jan 9, 2012 at 2:36 PM, Tom Szczesny <[email protected]> wrote:
> What surprised me was that the code in cutl was being reinterpreted by the
> J-interpreter for each element.
> I guess that's because the the conjuction is applied to a defined function,
> and not a primitive.
>
>
> On Sun, Jan 8, 2012 at 5:06 PM, Ric Sherlock <[email protected]> wrote:
>
>> To be precise cutl is being "fed" csvfile one record at a time by the
>> conjunction cut ( ;. ). ( cutl;._2 ) will chop its right argument into
>> bits using the last item of the right argument (probably a line-feed)
>> as the record delimiter (fret) and apply the verb u (in your case (
>> ','&cutl ) to each of those records.
>>
>> http://www.jsoftware.com/docs/help701/dictionary/d331.htm
>>
>> On Mon, Jan 9, 2012 at 6:50 AM, Tom Szczesny <[email protected]> wrote:
>> >
>> >    ',' &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
>> >>
>> > ----------------------------------------------------------------------
>> > For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to