[Jprogramming] NYCJUG meeting tomorrow, Tuesday, October 8th, 18:30 at BEST in Hoboken

2013-10-07 Thread Devon McCormick
More information on the J wiki at www.jsoftware.com/jwiki/NYCJUG or our Meetup page at http://www.meetup.com/J-Dynamic-Functional-Programming/ . I'll work on getting the wiki up-to-date over the coming week. -- Devon McCormick, CFA

[Jprogramming] How to make this conjunction tacit

2013-10-07 Thread Pascal Jasmin
   coerce =: 2 : ']`[email protected]'    < coerce (0= L.)2 ┌─┐ │2│ └─┘ It could also be written as (2 : 'u`]@.v'), and I would guess that is easier to make tacit, but I don't know how to do that one either. Maybe its not possible? -- For in

[Jprogramming] Slicing and dicing tables

2013-10-07 Thread Dan Farmer
Hello all, As I have been trying to improve my J skills I've been trying to incorporate it into my daily work, but I keep hitting a wall with my ability to dig in to "tables" (i.e., read in a CSV and then explore the data). I've seen Dan Bron mention perhaps putting together a wiki page about thi

Re: [Jprogramming] How to make this conjunction tacit

2013-10-07 Thread Dan Bron
Pascal asked: > How to make this conjunction tacit > coerce =: 2 : ']`[email protected]' coerce =: ^: < coerce (0=L.) 2 +-+ |2| +-+ < coerce (0=L.) <2 +-+ |2| +-+ This particular coercion is also available as a ready-made u

Re: [Jprogramming] Slicing and dicing tables

2013-10-07 Thread Marshall Lochbaum
You've got the arguments to i. backwards--the list to be searched is the left argument and the element to find is on the right. Assuming that hdr contains boxes, you also want the element to search for to be boxed. Then you would have hdr i. <'NameGiven' to find the name column. Another note is

Re: [Jprogramming] Slicing and dicing tables

2013-10-07 Thread Ganesh Rapolu
Because the data is boxed, all comparisons must be boxed. header =. {. data data =. }. data index =. header i. <'nameFirst' (<'Joe') +/@:= index {"1 data NB. 398 On Mon, Oct 7, 2013 at 10:25 AM, Marshall Lochbaum wrote: > You've got the arguments to i. backwards--the list to be searched is

Re: [Jprogramming] Slicing and dicing tables

2013-10-07 Thread Dan Farmer
Awesome! Thank you Ganesh and Marshall. Believe it or not this simple example (and a few variants that I'm sure I can come up with now that I've seen some of the basics) will allow me to use J much more every day. -Dan On Mon, Oct 7, 2013 at 1:42 PM, Ganesh Rapolu wrote: > Because the data is bo

Re: [Jprogramming] Slicing and dicing tables

2013-10-07 Thread Dan Bron
Ganesh Rapolu > Because the data is boxed, all comparisons must be boxed. This was very well put (one short sentence which both clarifies the problem and justifies the solution). -Dan -- For information about J forums see h

Re: [Jprogramming] Slicing and dicing tables

2013-10-07 Thread Dan Farmer
I hope you guys won't mind me extending this question, but just playing around with that data I got to thinking. Ok, I know there are 398 Joe's in here. What is the distribution of names like? Taking off from Ganesh's example NB. How many total? #(index {"1 data ) 18125 NB. How many unique

Re: [Jprogramming] Slicing and dicing tables

2013-10-07 Thread Roger Hui
You may also want to look at http://www.jsoftware.com/jwiki/Essays/Inverted_Table On Mon, Oct 7, 2013 at 1:47 PM, Dan Farmer wrote: > Awesome! Thank you Ganesh and Marshall. Believe it or not this simple > example (and a few variants that

Re: [Jprogramming] Slicing and dicing tables

2013-10-07 Thread Ganesh Rapolu
Understanding the adverb /. is key here. names =. index {"1 data ({. , <@#)/.~ names On Mon, Oct 7, 2013 at 11:41 AM, Dan Farmer wrote: > I hope you guys won't mind me extending this question, but just > playing around with that data I got to thinking. Ok, I know there are > 398 Joe's in here.

Re: [Jprogramming] Slicing and dicing tables

2013-10-07 Thread Devon McCormick
I tend to use delimited text files like this: 'hdr dat'=. split readcsv '/home/dan/Downloads/Master.csv' (<'Joe') +/ . =dat{"1 hdr i. <'nameFirst' NB. How many "Joe"s? where "split" is ({. ,&< }.).That is, split and assign the header and the data in one statement and don't bother assign

Re: [Jprogramming] Slicing and dicing tables

2013-10-07 Thread Devon McCormick
Sorry, should have been dat{"1~ not dat{"1 On Mon, Oct 7, 2013 at 5:53 PM, Devon McCormick wrote: > I tend to use delimited text files like this: > >'hdr dat'=. split readcsv '/home/dan/Downloads/Master.csv' >(<'Joe') +/ . =dat{"1 hdr i. <'nameFirst' NB. How many "Joe"s? > > w

Re: [Jprogramming] How to make this conjunction tacit

2013-10-07 Thread Jose Mario Quintana
shanghai=.(`]) (`(;:'`@.')) (@.(0 2 1 3)) (0=L.) < shanghai 2 2 (0=L.) < shanghai <2 ┌───┐ │┌─┐│ ││2││ │└─┘│ └───┘ Shanghai=. (]`) (`(;:'`@.')) (@.(0 2 1 3)) (0=L.) < Shanghai 2 ┌─┐ │2│ └─┘ (0=L.) < Shanghai <2 ┌─┐ │2│ └─┘ :) On Mon, Oct 7, 2013 at 4:23 PM, Dan Bron wrote

Re: [Jprogramming] Slicing and dicing tables

2013-10-07 Thread Eldon Eller
Data are plural. On 10/07/2013 02:04 PM, Dan Bron wrote: Ganesh Rapolu Because the data is boxed, all comparisons must be boxed. This was very well put (one short sentence which both clarifies the problem and justifies the solution). -Dan -

Re: [Jprogramming] How to make this conjunction tacit

2013-10-07 Thread Pascal Jasmin
may be duplicated, sorry. Thanks very much Dan, something a little silly with the original coerce definition is:    <`> coerce (1-L.) <<2 ┌─┐ │2│ └─┘ or    <`>`(>@>)`> coerce (1-L.) <<<2 ┌─┐ │2│ └─┘ Regarding the archeology archive, not all of those seem like good ideas.  What I would sugges

[Jprogramming] Documenting the i.-family: applications of dyad I.

2013-10-07 Thread Dan Bron
In [1], re J's the documentation, Joe Bogner wrote: > There are gaps [in the documentation] that can be > frustrating. Most of the work I've done so far has > been heavily depending upon i., E., e., I. ~. /. > [and] the standard vocabulary pages are light on > information. The primitives

Re: [Jprogramming] How to make this conjunction tacit

2013-10-07 Thread Dan Bron
Pascal wrote: > something a little silly with the original coerce definition is: > <`> coerce (1-L.) <<2 > +-+ > |2| > +-+ > or > <`>`(>@>)`> coerce (1-L.) <<<2 > +-+ > |2| > +-+ This is J. You don't need silly tricks. You only need algebra: coerce =: ^: <

Re: [Jprogramming] How to make this conjunction tacit

2013-10-07 Thread Dan Bron
Yes, sorry, I pasted the wrong excerpt from my J session (you can see the example I executed had the adverb named yyy before I pun-ified it). It's also worth pointing out that this particular "tacit adverb" is just a painfully convoluted way of writing 2 : ']`[email protected]' so we don't have to use : and

Re: [Jprogramming] How to make this conjunction tacit

2013-10-07 Thread Pascal Jasmin
may be duplicated, sorry. Thanks very much Dan, something a little silly with the original coerce definition is:    <`> coerce (1-L.) <<2 ┌─┐ │2│ └─┘ or    <`>`(>@>)`> coerce (1-L.) <<<2 ┌─┐ │2│ └─┘ Regarding the archeology archive, not all of those seem like good ideas.  What I would sugges

Re: [Jprogramming] Slicing and dicing tables

2013-10-07 Thread Dan Bron
You mean " 'data' is plural " . -Dan PS: http://en.m.wikipedia.org/wiki/Muphry's_law (Yes, that link is spelled correctly :) Please excuse typos; composed on a handheld device. On Oct 7, 2013, at 8:00 PM, Eldon Eller wrote: > Data are plural. > > On 10/07/2013 02:04 PM, Dan Bron wrote: >>

Re: [Jprogramming] Slicing and dicing tables

2013-10-07 Thread Joe Bogner
Hi Dan, I similarly struggled when I first started and also use J to work with flat files. Here are some examples of different ways of working with the data: load 'tables/csv' t=. readcsv '/temp/Master.csv' cols=. {.t NB. head of t data=. }. t

Re: [Jprogramming] Slicing and dicing tables

2013-10-07 Thread Henry Rich
That is what he meant, but it's a minority opinion. Henry Rich On 10/7/2013 8:56 PM, Dan Bron wrote: You mean " 'data' is plural " . -Dan PS: http://en.m.wikipedia.org/wiki/Muphry's_law (Yes, that link is spelled correctly :) Please excuse typos; composed on a handheld device. On Oct 7, 20

Re: [Jprogramming] How to make this conjunction tacit

2013-10-07 Thread Pascal Jasmin
epic post you linked to.  Thank you.  This was new to me: > You'd also be surprised how often 1=*/'' helps you out, either directly or >indirectly (the phrase means that the product of an empty list is 1, because 1 >is the identity element of * on coerce, I'm using it for functions that norma