[Jprogramming] Working with big arrays

2015-12-25 Thread Ryan Eckbo
I'm processing some big files on the order of 2G, extracting >= 250M of data from each. I have to memory map them to get the data: readbigfile=: 3 : 0 JCHAR map_jmf_ 'f';y NB. get data from f unmap_jmf_'f' ) I have about 150 of these files together with matching smaller ones, and I need

[Jprogramming] Work-around for FIFA/

2015-12-25 Thread 'Bo Jacoby' via Programming
Dear experts. This program works correctly for scalar input. FIFA=.[([:+/!*2^-@>:@])(+i.&>:)    2 FIFA 30.65625 It is the probability that the winning team of a soccermatch that ended 2-3, is indeed the better of the two teams. I want a table, but (i.11)FIFA/ i.11 doesn't do it. What is the work-a

Re: [Jprogramming] Work-around for FIFA/

2015-12-25 Thread Mike Day
How about this: NB. I used extended integer to give rationals; NB. I intended to show a compactly presented table, NB. but Thunderbird seems to have spoilt it! FIFA"0/~ i.5x 1r2 3r47r8 15r16 31r32 1r4 1r2 11r16 13r16 57r64 1r8 5r161r2 21r32 99r128 1r16 3r16 11r321r

Re: [Jprogramming] Working with big arrays

2015-12-25 Thread Raul Miller
When you want to see how J will proceed, you can set up an experiment, and use echo to show what is happening when. That said, your "0 verb will operate a box at a time (or a pair of boxes at a time, since it's dyadic - the "0/ verb thus operating a pair of boxes at a time but being monadic...).

[Jprogramming] A result I don't understand

2015-12-25 Thread Linda A Alvord
Extending an example on composition from Sykes's LJ, I made the final step. What's happening here? A=:i.2 2 f=:< g=:+/"1 f @ g A --T-┐ │1│5│ L-+-- f & g A --T-┐ │1│5│ L-+-- f"0 g A --T-┐ │1│5│ L-+-- f @: g A ┐ │1 5│ L f &: g A ┐ │1 5│ L

Re: [Jprogramming] A result I don't understand

2015-12-25 Thread Linda A Alvord
Here's the dialog: A=:i.2 2 f=:< g=:+/"1 f @ g A f & g A f"0 g A f @: g A f &: g A f g A (f g) A h=: 13 :'f"0 g y' h A i=: 13 :'f g y' i A j=: 13 :'(f g)A' j A h i j Linda -Original Message- From: [email protected] [mailto:[email protected]

Re: [Jprogramming] Work-around for FIFA/

2015-12-25 Thread David Lambert
FIFA=.[([:+/!*2^-@>:@])(+i.&>:) FIFA b. 0 NB. FIFA has infinite rank _ _ _ + b. 0 NB. You need rank 0 0 0 0 FIFA"0/~i.4xNB. the table 1r2 3r4 7r8 15r16 1r4 1r2 11r16 13r16 1r8 5r16 1r2 21r32 1r16 3r16 11r32 1r2 NB. FIFA_NAUGHT requires rank 0 NB.

Re: [Jprogramming] A result I don't understand

2015-12-25 Thread Raul Miller
I do not understand your question. Are you asking why a hook is different from some other form of composition? Thanks, -- Raul On Fri, Dec 25, 2015 at 7:45 AM, Linda A Alvord wrote: > Extending an example on composition from Sykes's LJ, I made the final step. > What's happening here? > > >

Re: [Jprogramming] A result I don't understand

2015-12-25 Thread Linda A Alvord
I don't understand how (f g) A 1 0 1 1 Where are the verbs f and g when you display the definition of I ? Linda What is it doing to make this result? -Original Message- From: [email protected] [mailto:[email protected]] On Behalf Of R

Re: [Jprogramming] A result I don't understand

2015-12-25 Thread Linda A Alvord
I mean j (the message escaped when I was making a change) j=: 13 :'(f g)A' j (2 2$1 0 1 1)"_ j A 1 0 1 1 -Original Message- From: [email protected] [mailto:[email protected]] On Behalf Of Linda A Alvord Sent: Friday, December 25, 2

Re: [Jprogramming] A result I don't understand

2015-12-25 Thread Linda A Alvord
I found my mistake just then. A should be y. However, I still do not understand how it gets the result shown: j=: 13 :'(f g)y' j f g j A 1 0 1 1 Linda -Original Message- From: [email protected] [mailto:[email protected]] On Beha

Re: [Jprogramming] A result I don't understand

2015-12-25 Thread robert therriault
Hi Linda, j NB. Even though j returns f g, it is really (f g) which is a hook and is not the same as f g A f g j=: 13 :'(f g)y' f=:< g=:+/"1 A=:i.2 2 j A 1 0 1 1 (f g) A 1 0 1 1 A f g A NB. (f g) n <=> n f (g n) 1 0 1 1 f g A NB. I am guessing that this is what you were

Re: [Jprogramming] A result I don't understand

2015-12-25 Thread Linda A Alvord
AHA Bob, I see the "logic" of it. F turns from "box" to "less than" ( Some days I see a fork in the road, but this wasn't one of them.) Thanks, Linda -Original Message- From: [email protected] [mailto:[email protected]] On Behalf Of rober

Re: [Jprogramming] Work-around for FIFA/

2015-12-25 Thread 'Bo Jacoby' via Programming
Thank you very much!- Bo Den 15:07 fredag den 25. december 2015 skrev David Lambert :     FIFA=.[([:+/!*2^-@>:@])(+i.&>:)     FIFA b. 0  NB. FIFA has infinite rank _ _ _     + b. 0      NB. You need rank 0 0 0 0     FIFA"0/~i.4x        NB. the table   1r2  3r4  7r8 15r16   1r4  1

Re: [Jprogramming] Working with big arrays

2015-12-25 Thread Devon McCormick
I've developed an adverb for working with large files: http://code.jsoftware.com/wiki/NYCJUG/2014-05-13#Streaming_Through_Large_Files . An example of using this code can be found here - http://code.jsoftware.com/wiki/User:Devon_McCormick/Code/largeFileVet - and the updated version of the code here

[Jprogramming] advent of code, days 36bl 25

2015-12-25 Thread David Lambert
NB. Christmas NB. To continue, please consult the code grid in the manual. Enter the code at row 2978, column 3083. n=:]+[:-:[:*/_2 _1++ NB. ROW n COL REPEATS=: 2978 n 3083 START=: 20151125 PART1=: (33554393x|252533x*])^:(REPEATS-1)x:START PART2=: 'finish the other 5!' NB. Day 21

Re: [Jprogramming] advent of code, days 36bl 25

2015-12-25 Thread Moon S
I had nearly the same for the last day. Then remembered that J has modular exponentiation optimized. And I have 64-bit J, so no need for extended numbers. 3 timex '(33554393&|@*&252533)^:(2947(<.&-:@(*:@+-3&*@[+]))3029)20151125' 5.12972 3 timex '33554393|20151125*(33554393&|@^&(2947(<.&-:@(*