Re: [Jprogramming] J and Group Theory

2013-12-11 Thread David Lambert
In response to a similar question I asked a few years ago Roger Hui's response introduced me to the outstanding j essays. Start from the odometer essay: http://www.jsoftware.com/jwiki/Essays/Odometer On 12/11/2013 11:50 AM, programming-requ...@forums.jsoftware.com wrote: Date: Wed, 11 Dec 2

Re: [Jprogramming] Beginner Understanding CSV file reading/writing

2013-12-11 Thread Raul Miller
If your multi-line file is clean (last character is a newline), use: csv_parser;._2 Thanks, -- Raul On Wed, Dec 11, 2013 at 7:39 PM, Tom Arneson wrote: > I just tried the Finite State Machine parser from the url below. It doesn't > correctly parse multi line csv files. Can someone sugge

Re: [Jprogramming] Data from kaggle competition: packing Santa's sleigh

2013-12-11 Thread Linda Alvord
Here's another option. a=:>:i.250 b=:>:?100#250 f=: 13 :'+/"1 x=/y' (>:i.250) f >:?100#250 (>:i.250) f >:?100#250 Linda -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Kenneth Le

Re: [Jprogramming] Beginner Understanding CSV file reading/writing

2013-12-11 Thread Tom Arneson
I just tried the Finite State Machine parser from the url below. It doesn't correctly parse multi line csv files. Can someone suggest changes so it will? -Original Message- From: programming-boun...@forums.jsoftware.com [mailto:programming-boun...@forums.jsoftware.com] On Behalf Of Devon

Re: [Jprogramming] Data from kaggle competition: packing Santa's sleigh

2013-12-11 Thread Don Guinn
I'm not sure of the purpose of a. If the list only needs to be sorted then the following is faster and also gives a 2 column array with the first column being what a should be and the second column the count. /:~({.,#)/.~b On Wed, Dec 11, 2013 at 2:56 PM, Thomas Costigliola wrote: > Don, th

Re: [Jprogramming] Data from kaggle competition: packing Santa's sleigh

2013-12-11 Thread Thomas Costigliola
Don, that will still count duplicate values of b not in a, the count will just be off by one. You can just ignore those afterwards though: count1=. (#@[ {. <:@#/.~@,) Or you can filter before counting: count2=. ([:<:[:#/.~,#~[e.~,) ts=: 6!:2,7!:2@] NB. time & space a=: >: i.10 b=: ?100

Re: [Jprogramming] Data from kaggle competition: packing Santa's sleigh

2013-12-11 Thread Don Guinn
Here is another way. <:#/.~a,b This produces a zero count for values of b not in a. On Wed, Dec 11, 2013 at 11:30 AM, Ni Bo wrote: > Thank you. Will try it later on the data. > > Nick > Am 11.12.2013 20:16 schrieb "Kenneth Lettow" : > > > How about > > > >a=: 1 2 3 4 5 6 > >b=: 14

Re: [Jprogramming] Data from kaggle competition: packing Santa's sleigh

2013-12-11 Thread Ni Bo
Thank you. Will try it later on the data. Nick Am 11.12.2013 20:16 schrieb "Kenneth Lettow" : > How about > >a=: 1 2 3 4 5 6 >b=: 14 3 2 5 6 2 1 1 2 3 4 2 3 >+/"1 (a=/b) > 2 4 3 1 1 1 >{:"1 /:~(~.,#)/.~(#a)-.~a i. b > 2 4 3 1 1 1 >NB. make it a verb >doit=: 4 : '{:"1 /:~(~

Re: [Jprogramming] Data from kaggle competition: packing Santa's sleigh

2013-12-11 Thread Kenneth Lettow
How about a=: 1 2 3 4 5 6 b=: 14 3 2 5 6 2 1 1 2 3 4 2 3 +/"1 (a=/b) 2 4 3 1 1 1 {:"1 /:~(~.,#)/.~(#a)-.~a i. b 2 4 3 1 1 1 NB. make it a verb doit=: 4 : '{:"1 /:~(~.,#)/.~(#x)-.~x i. y' a doit b 2 4 3 1 1 1 NB. larger args a=: >: i.10 b=: ?1$20 a d

Re: [Jprogramming] Beginner Understanding CSV file reading/writing

2013-12-11 Thread Björn Helgason
If you want to inspect data and especially if there are invisible chars it can be good to use a. i. Like here when I copied text from the message: a=. ('1,2,"embedded, comma",3.4',CR,LF,'5,6,"no comma",7.8') |spelling error |a=. ('1,2,"embedded, comma",3.4',CR,LF,'5,6,"no comma",7.8') |

[Jprogramming] Data from kaggle competition: packing Santa's sleigh

2013-12-11 Thread Ni Bo
Hi, I'm using the data off the kaggle competition to learn some j. This simple code works for these short strings: a=:1 2 3 4 5 6 b=:14 3 2 5 6 2 1 1 2 3 4 2 3 +/"1 (a=/b) 2 4 3 1 1 1 But if I try it for longer strings #a 250 and #b 1 000 000 I get out of memory. Can you please help me with

Re: [Jprogramming] J and Group Theory

2013-12-11 Thread Jon Hough
Exactly. So simple.Thanks! > Date: Wed, 11 Dec 2013 11:43:15 -0500 > From: klet...@thomasnet.com > To: programm...@jsoftware.com > Subject: Re: [Jprogramming] J and Group Theory > > Is this what you need? > >#:i.4 > 0 0 > 0 1 > 1 0 > 1 1 >'a b c d'=: #:i.4 >a > 0 0 >b > 0 1 >

Re: [Jprogramming] J and Group Theory

2013-12-11 Thread Kenneth Lettow
Is this what you need? #:i.4 0 0 0 1 1 0 1 1 'a b c d'=: #:i.4 a 0 0 b 0 1 c 1 0 d 1 1 On Wed, Dec 11, 2013 at 11:36 AM, Jon Hough wrote: > Hi, > > > I saw in the J labs the example for the group Z_4 (cyclic group of order > 4). > > > > I am now trying to ape this method to c

[Jprogramming] J and Group Theory

2013-12-11 Thread Jon Hough
Hi, I saw in the J labs the example for the group Z_4 (cyclic group of order 4). I am now trying to ape this method to create the group Z_2 x Z_2 (direct product of cyclic group order 2 with itself). This is what I have done so far: a =: 0 0 b =: 0 1 c =: 1 0 d =: 1 1 f =:

Re: [Jprogramming] Beginner Understanding CSV file reading/writing

2013-12-11 Thread Jon Hough
Thanks for the replies. It's going to take a while to take all this in. Regards, Jon > Date: Tue, 10 Dec 2013 11:38:30 -0500 > From: devon...@gmail.com > To: programm...@jsoftware.com > Subject: Re: [Jprogramming] Beginner Understanding CSV file reading/writing > > You may also want to look at