As mentioned in the dictionary entry for cut:
the phrase   u;._2 y     applies the verb u to each interval created by cut,
where the fret is the last item, and marks the ends of the intervals.

What is the notation for applying the "each" concept to a verb independent
of   cut   ?
For example,
   <i.7
+-------------+
|0 1 2 3 4 5 6|
+-------------+

How do you express
    <  each  i.7
and get 7 individually boxed items?
(I could not find an entry for "each" in the Index, nor in the Vocabulary.)


Follow-up question:  I understand that when applying the "each" concept to
either an explicitly or tacitly defined verb, the interpreter would need to
re-evaluate the verb for each item.  But what about the case above?  (I
would guess that there might be only a single evaluation by the interpreter
for the phrase      < each i.7   ).



On Mon, Jan 9, 2012 at 9:19 AM, Raul Miller <[email protected]> wrote:

> Note that explicit verbs are a special case of tacit verbs.  In the
> case of explicit verbs, the data structure which represents the verb
> represents an explicit definition.  For example:  [: : - is a tacit
> definition, while 4 : 'x - y' is an explicit definition.
>
> In most cases, tacit verbs will have to be re-evaluated "for each
> record".  (The exception would be if relevant special code existed for
> the tacit verb).
>
> --
> Raul
>
> On Sun, Jan 8, 2012 at 10:19 PM, Ric Sherlock <[email protected]> wrote:
> > 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
> ----------------------------------------------------------------------
> 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