Re: [Jprogramming] Boxing columns

2014-11-20 Thread Ryan
I'm new to J and am struggling to figure out why this works. '';1 just looks like a noun: '';1 ┌┬─┐ ││1│ └┴─┘ <;.1 i.3 3 ┌─┐ │0 1 2│ │3 4 5│ │6 7 8│ └─┘ thanks for any help, Ryan On 20 Nov 2014, at 9:27, Roger Hui wrote: > ('';1) <;.1

[Jprogramming] Split on first found character

2014-11-25 Thread Ryan
LF headLF=: {.~ i.&LF tailLF=: }.~ i.&LF (headLF ; filterLF@tailLF) x ┌┬─┐ │>case_id│GCTAGTCGACGTC│ └┴─┘ (I'm reading text files in fasta format: http://rosalind.info/glossary/fasta-format/) Thanks for any suggestions, Ryan The informa

[Jprogramming] J and data analysis/relational algebra

2014-12-07 Thread Ryan
able to (mainly on a bunch of csv files): Do unions, joins, selects, filters, group by's, and create new columns as functions of other columns. I want to get a sense of how easy it is compared to R, and hopefully learn efficient ways of doing it in J. thanks for any help, Ryan The informati

[Jprogramming] jpegs

2015-01-14 Thread Ryan
I found an add-on for reading jpegs (`addons/jpeg`), but can't find any documentation. When I use 'readjpeg' it says it cannot read the jpeg file I'm trying to load. Is there information out there on how to load, view, and manipulate jpegs? The information in this e-mail is intended only for

Re: [Jprogramming] jpegs

2015-01-18 Thread Ryan
It works in jconsole, but not in jqt: load'jpeg' readjpeg '~/j/cat.jpg' Qt cannot read JPEG file Does anyone know how I can fix this? thanks, Ryan On 15 Jan 2015, at 19:22, bill lam wrote: > It is similar to reading/writing bmp, ie. readjpeg and writejpeg > On J

Re: [Jprogramming] jpegs

2015-01-19 Thread Ryan
readjpeg jpath '~/j/cat.jpg' - Original Message - From: Ryan To: programm...@jsoftware.com Cc: Sent: Monday, January 19, 2015 12:42 AM Subject: Re: [Jprogramming] jpegs It works in jconsole, but not in jqt: load'jpeg' readjpeg '~/j/cat.jpg' Qt cannot r

[Jprogramming] 2D probability distribution plot

2015-01-20 Thread Ryan
at=? 27 27$0 load 'graphics/plot viewmat' 'density' plot mymatrix NB. or viewmat mymatrix I've looked through plot's source code but don't see an option for something like this. Does someone know if it's possible to do? thanks for a

Re: [Jprogramming] 2D probability distribution plot

2015-01-26 Thread Ryan
he dictionary. But sometimes, especially after you've tried some of those other approaches, it can be good to have someone else give their perspective - not so much because it's not simple but because having other people's words can help you think about things from a slightly diff

Re: [Jprogramming] 2D probability distribution plot

2015-01-27 Thread Ryan
you've tried some of those other approaches, it can be good to have someone else give their perspective - not so much because it's not simple but because having other people's words can help you think about things from a slightly different perspective.) Thanks, -- Raul

Re: [Jprogramming] 2D probability distribution plot

2015-01-28 Thread Ryan
Thanks Skip. FYI here's my post on how I used the plot to show the probability distribution of letter bigrams in the Linux FAQ: http://reckbo.com/2015/01/28/mackay03-in-j-bigrams/ ryan On 28 Jan 2015, at 16:48, Skip Cave wrote: This link seems to work: http://www.cs.toronto.edu/~m

[Jprogramming] Bar plot - x axis

2015-02-07 Thread Ryan
Why does the x-axis always start at 1 in bar plots, even when x data is given? eg. 'bar' plot (];*:) i.5 generates a bar plot where x=1..5, and not x=0..4 Same for 'hist', 'sbar', etc. thanks for any help, Ryan The information in this e-mail is intended onl

Re: [Jprogramming] Bar plot - x axis

2015-02-07 Thread Ryan
ld tell me if I'm missing something. On 8 Feb 2015, at 5:45, Björn Helgason wrote: > It is a good idea to look at the plot demos and then when you see what you > want/need then the definition gives you ideas/hints/solutions. > On 7 Feb 2015 08:25, "Ryan" wrote: > >&

[Jprogramming] Wrong numbers in normal distribution?

2015-03-11 Thread Ryan
0 2.86652e_7 3.16712e_5 0.0013499 0.0227501 0.158655 0.5 In R: cat(pnorm(-9:0)) 1.128588e-19 6.220961e-16 1.279813e-12 9.865876e-10 2.866516e-07 3.167124e-05 0.001349898 0.02275013 0.1586553 0.5 Does anyone know why? thanks, Ryan The information in this e-mail is intended only for the person to w

[Jprogramming] OpenGL lab

2015-05-05 Thread Ryan
Hi, When I try to run the OpenGL lab I get Lab dependency not an addon: /Users/ryan/j64-803/bin/gl3 I checked my add ons and I have gl2, but I can't find anything on the wiki about gl3. Does anyone know how to get this lab to run? thanks, Ryan The information in this e-mail is int

[Jprogramming] command line script

2015-05-06 Thread Ryan
Hi, Is it possible to write a standalone J script similar to a bash or python script that you can run from the command line (in Linux or Mac terminal)? What would be the shebang line? Ryan The information in this e-mail is intended only for the person to whom it is addressed. If you believe

[Jprogramming] gl2 labs

2015-05-14 Thread Ryan
n on other aspects of gl2. I suppose that currently the best way to learn GUI/openGL programming is to go through the qt demo code and the wiki reference guides? Ryan The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent

Re: [Jprogramming] gl2 labs

2015-05-31 Thread Ryan
15 7:28 AM, "Ryan" wrote: FYI, as there are no longer any openGL labs, this line at http://www.jsoftware.com/jwiki/Guides/Window%20Driver/gl2%20Command%20Reference is misleading: Lab "Graphics - gl2 commands" gives an overview of the isigraph control and gl2 commands. S

[Jprogramming] Change directory

2015-06-15 Thread Ryan Eckbo
Hi all, I'm wondering if there's a shorthand for changing directory I'm not aware of instead of using 1!:44 'dir/path' ? I don't think there is but I want to make sure, since I use it often. If not would it be reasonable to add something like

[Jprogramming] html screen scraping

2015-07-14 Thread Ryan Eckbo
Hi everyone, I want to scrape some web pages and I am wondering if anyone here uses J to do so? Any tips? Otherwise I'll have to resort to python. Thanks for any suggestions, Ryan -- For information about J forums see

[Jprogramming] Read MATLAB files into J

2015-07-14 Thread Ryan Eckbo
I recently had to operate on some data saved in Matlab files so I wrote an interface for J. Here it is in case it's useful to anyone else. https://github.com/reckbo/jmatlab -- For information about J forums see http://www.jsoftwa

Re: [Jprogramming] html screen scraping

2015-07-21 Thread Ryan Eckbo
I ended up just using w3m to render the html as text and then used sed, csplit, and cut to convert it csv files (github.com/reckbo/aflstats) On 14 Jul 2015, at 22:19, Ryan Eckbo wrote: Hi everyone, I want to scrape some web pages and I am wondering if anyone here uses J to do so? Any tips

[Jprogramming] auto completion

2015-11-02 Thread Ryan Eckbo
way to configure J to not add this trailing space? 2. How do you complete paths in jqt? 3. Can you configure J to tab complete noun and verb names (user defined or those in the standard library)? Thanks in advance for any help, Ryan ---

[Jprogramming] Is it possible to set an environment variable?

2015-11-14 Thread Ryan Eckbo
I don't think this is possible but I want to make sure. Or maybe there are some hacks? (I see Raul requested this back in 2005) -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Is it possible to set an environment variable?

2015-11-15 Thread Ryan Eckbo
Great, works on my Mac. Thanks! On 15 Nov 2015, at 15:11, bill lam wrote: Depending on platforms, you can call c library, eg linux, ((unxlib 'c'),' setenv > i *c *c i')&(15!:0)'foo';'bar';1 0 2!:5 'foo' bar Вс, 15 ноя 2015, Ryan Ec

[Jprogramming] jdb confusion

2015-11-23 Thread Ryan Eckbo
code below. Does anyone see the problem? thanks, Ryan NB. requires that folder 'dbs' exists require'data/jdb csv' boxcsv=.([: <;._1 ','&,);._2 dataFromCsv=:<"_1@:|:@:}.NB. strip header and box columns

Re: [Jprogramming] advent of code - day 2

2015-12-03 Thread Ryan Eckbo
And mine: # part 1 Presents=. do each ('x'&cut);._2 freads'/tmp/input.txt' sa=: 3 : '(l*w) + (2*l*w) + (2*w*h) + 2*h*l [ ''l w h''=. /:~y' +/ sa"1 Presents # part 2 ribbon=. +/@:+:@:}:@:(/:~)@:> vol=. */@:> +/ (vol + ribbo

[Jprogramming] advent of code - day 3

2015-12-03 Thread Ryan Eckbo
Data=. }: freads'/tmp/input.txt' houses=: 3 : '+/\ (0 0), (4 2$0 1 1 0 0 _1 _1 0){~ ''^>v<'' i. y' # part 1 {. $ ~. houses Data # part 2 santa=. 2 | i. # Data robo=. -. santa {. $ ~. (santa&# ,&shouses robo&#) Data -- For in

Re: [Jprogramming] advent of code - day 3

2015-12-03 Thread Ryan Eckbo
er wrote: Mine: data=:fread 'advent2015/day3.txt' getMoves=: ((0,1),(0,_1),(1,0),:(_1,0)) {~ ('^v><' i. ]) addStart =: (1 2 $ 0) , ] smoutput answer1 =: # ~. +/\ addStart @: getMoves data smoutput answer2 =: # ~. _2[\ ; +/\"2 (((0,1) $~ #) addStart@,./. getMov

Re: [Jprogramming] adventofcode 6

2015-12-06 Thread Ryan Eckbo
How do your on/off/toggle functions work? My solution also updates a global matrix, but my implementation doesn't feel good. Looking forward to seeing nicer solutions. xind=: 3 : 0&{ + [: i. >:@:(-/)@:(2 0&{) yind=: 3 : 1&{ + [: i. >:@:(-/)@:(3 1&{) mkmask=: 3 : '1 inds} 1000 1000 $ 0 [ inds=

Re: [Jprogramming] adventofcode 6

2015-12-06 Thread Ryan Eckbo
: (1000 1000 {. ({. ($&1)))/@(-~/\)@:-@(,:~ >:) turn =: 1 : 'u' '`off on toggle' =: >`+.`~: +/@, 3 : i 1000 1000 $ 0 For part 2, use '`off on toggle' =: (0 >. -)`+`(+ +:) On 12/6/2015 6:03 PM, David Lambert wrote: Ryan made a mask shape 1000 1000 and

Re: [Jprogramming] adventofcode/day/8

2015-12-09 Thread Ryan Eckbo
I wanted to visualise this with the graphviz addon (http://code.jsoftware.com/wiki/Addons/graphics/graphviz), but that seems to have disappeared, i.e. its not in the package manager. Anyone know what happened to it? In any case, this answer helped me learn J's FSM. thanks! Ryan On

Re: [Jprogramming] advent 9 , and graphviz reference

2015-12-09 Thread Ryan Eckbo
Mine looks similar: input=: 0 2 4{"1 ' '&cut;._2 freads'9.txt' cities=:~. , }:"1 input dists=: > ".each {:"1 input edges=: <@/:~"1 }:"1 input getdist=: (dists {~ edges i. <)@/:~ getpathdist=: +/@:(2&(getdist\)) <./ getpathdist"1 (i.@!@# A. ] )cities On 10 Dec 2015, at 12:09, Joe Bogner wrote:

[Jprogramming] advent 8

2015-12-10 Thread Ryan Eckbo
A previous advent answer got me thinking about state machines, so I wrote one for this problem. The extra initial state ruins the natural mapping between states and numbers, but I think it's unavoidable? Also someone could probably write a clever verb to generate the table. NB. state machin

[Jprogramming] advent 10

2015-12-10 Thread Ryan Eckbo
Oops, typo in the title - this is for day 10, not 8. On 10 Dec 2015, at 19:52, Ryan Eckbo wrote: A previous advent answer got me thinking about state machines, so I wrote one for this problem. The extra initial state ruins the natural mapping between states and numbers, but I think it&#

[Jprogramming] regex confusion

2015-12-10 Thread Ryan Eckbo
I believe there should only be one match. Why are there 3? load'regex' '^B' rxmatches 'BBB my sentence' 0 1 1 1 2 1 -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] regex confusion

2015-12-10 Thread Ryan Eckbo
hat ^B match 3 times. Not sure this is a bug or a feature. Чт, 10 дек 2015, Ryan Eckbo написал(а): I believe there should only be one match. Why are there 3? load'regex' '^B' rxmatches 'BBB my sentence' 0 1 1 1 2 1 -

Re: [Jprogramming] advent 8

2015-12-11 Thread Ryan Eckbo
0.2 1.2 2.2 3.2 4.2 5.2 6.2 7.0 8.2 9.2 [8] 0.2 1.2 2.2 3.2 4.2 5.2 6.2 7.2 8.0 9.2 [9] 0.2 1.2 2.2 3.2 4.2 5.2 6.2 7.2 8.2 9.0 ) But that might be taking things too far... Thanks, -- Raul On Thu, Dec 10, 2015 at 3:52 AM, Ryan Eckbo wrote: A previous advent answer

Re: [Jprogramming] advent 8

2015-12-11 Thread Ryan Eckbo
Much better than the one I came up with. I found removing the parentheses around (_0.1) made it even clearer. On 11 Dec 2015, at 2:55, Joe Bogner wrote: On Thu, Dec 10, 2015 at 3:52 AM, Ryan Eckbo wrote: Also someone could probably write a clever verb to generate the table. I don&#

Re: [Jprogramming] adventofcode 11

2015-12-11 Thread Ryan Eckbo
Here's my version (&. is one of my favourite J operators): pass=:'hxbxwxba' alpha=: a.{~ 97+i.26 inc=: >:&.(26&#.)&.(alpha&i.) nobad=: -.@:(+./)@:('iol'&e.) strt=: +./@:(3 (0 1 2 -: ([ - {.)@:(alpha&i.))\ ]) NB. this is ugly pairs=:1&<@:#@:~.@:((#~ ,&0) (2 -:/\ ])) good=: pairs *. strt *. nobad s

Re: [Jprogramming] adventofcode 11

2015-12-12 Thread Ryan Eckbo
; NB. 'z' equivalent to 'az' ba inc 'axyz' NB. beheaded xza One fix is to hardcode the number of letters: inc=: >:&.(26 26 26 26&#.)&.(alpha&i.) inc 'axyz' axza On 12 Dec 2015, at 14:49, Geoff Canyon wrote: On Fri, Dec 11, 2015 a

Re: [Jprogramming] advent 13

2015-12-13 Thread Ryan Eckbo
Here's my solution -- like Joe I also just modified earlier input to get part 2's answer. NB. part 1 Edges=: (0 9 2 { ;:@:}:);._2 'gain' delstring ('lose ';'_') rplc~ Input ppl=: ~. {."1 Edges EdgesD=: /:~ Edges, |: ppl,ppl,:<'0' NB. add diagonal elements Tbl=: (".@>)/./ 0 2 { |: EdgesD NB. ha

Re: [Jprogramming] advent 13

2015-12-13 Thread Ryan Eckbo
for this great example! On Mon, Dec 14, 2015 at 12:46 AM, Ryan Eckbo wrote: Here's my solution -- like Joe I also just modified earlier input to get part 2's answer. NB. part 1 Edges=: (0 9 2 { ;:@:}:);._2 'gain' delstring ('lose ';'_') rplc~ Input ppl=:

Re: [Jprogramming] advent 14

2015-12-14 Thread Ryan Eckbo
I don't understand what Y is, could you explain that? On 14 Dec 2015, at 17:10, 'Pascal Jasmin' via Programming wrote: > in =. ". leaf (3 8 _2 { ;:)"1 a =. > cutLF wdclippaste '' > Y =: (&({::))(@:]) > > part1 : > >> ./ {:"1 +/\@(2503 $ (0 #~ 2 Y) ,~ 1 Y # 0 Y)"1 in > > 2: > >> ./ (] +/@(="1 1)

Re: [Jprogramming] advent 14

2015-12-14 Thread Ryan Eckbo
ate distances > >> ./ (0&{ * (_,1&{) ([ #. <.) 2503 #:~ (0,+/@(1 2&{)))"1 sfr > > > NB. Part 2. Total rewrite required > >> ./ +/"1 (="1 >./) +/\"1 (2503 $ *`(1 0 #~ ,)/)"1 sfr > > > > Henry Rich > > > &

[Jprogramming] advent 16

2015-12-16 Thread Ryan Eckbo
This one took a while, whew. load'regex' Defaults=:', ', ': _',~ ': _, 'joinstring <;._2 [ 0 : 0 children cats perfumes samoyeds pomeranians akitas vizslas goldfish trees cars ) NB. part 1 parse=: deb L:0@:(':'&cut each)@:(','&cut) Input0=: ('^Sue \d+: ';'') rxrplc fread'16.txt' Input=: deb L:0

[Jprogramming] regex on binary string

2015-12-22 Thread Ryan Eckbo
Why doesn't regex work on binary? e.g. load'regex' 'a' rxmatch a. _1 0 'a' rxmatch AlphaNum_j_ 26 1 -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] regex on binary string

2015-12-22 Thread Ryan Eckbo
hich are null terminated. So you need to get rid of any > nulls if you want regex to go past them. > > 'a' rxmatch ' ' 0} a. > 97 1 > > I hope this helps, > > -- > Raul > > > On Tue, Dec 22, 2015 at 8:29 PM, Ryan Eckbo wrote: >> Why do

[Jprogramming] Working with big arrays

2015-12-25 Thread Ryan Eckbo
ght after execution? In general I don't know how to deal with huge arrays. Thanks for any help, Ryan -- For information about J forums see http://www.jsoftware.com/forums.htm

Re: [Jprogramming] Working with big arrays

2016-01-02 Thread Ryan Eckbo
myverb in your J session. I hope this helps, -- Raul On Fri, Dec 25, 2015 at 4:51 AM, Ryan Eckbo wrote: 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_ '

[Jprogramming] Faster array lookup? (poker hand evaluator)

2016-01-02 Thread Ryan Eckbo
I've implemented the twoplustwo 7 card poker hand evaluator[1] in J but it's slower than I expected. The evaluator works by accepting an array of 7 integers between 1 and 52, representing a 7 card hand, and uses them as indices in a lookup table, which returns the best 5 card hand's rank value.

Re: [Jprogramming] Faster array lookup? (poker hand evaluator)

2016-01-03 Thread Ryan Eckbo
but only 7462 distinct hand values. The hand values returned by HR aren't in this range but they do guarantee that if HR[hand1_idx] > HR[hand2_idx] then hand1 beats hand2. Thanks for the help! Ryan On 3 Jan 2016, at 14:56, Ryan Eckbo wrote: I've implemented the twoplustwo 7 card

Re: [Jprogramming] Faster array lookup? (poker hand evaluator)

2016-01-04 Thread Ryan Eckbo
to me. When I time a + a on 1e7 ints, I get about .03 sec. When I time a { i. 100 on 1e7 ints, I get about the same. This program should be about 14 of those, and thus take around 0.5 sec. 3 sec is way too high. Can you dig into this and see where the time is going? Henry Rich On

Re: [Jprogramming] J804 released

2016-01-04 Thread Ryan Eckbo
Wow this is cool, I may have to start using jqt more. Ryan On 5 Jan 2016, at 15:14, Henry Rich wrote: > It's described at > > http://code.jsoftware.com/wiki/Vocabulary/Dissect#J8.03_and_later > > Henry Rich > > > On 1/4/2016 10:43 PM, Devon McCormick wrote: >

Re: [Jprogramming] Qt form with plot

2016-01-06 Thread Ryan Eckbo
v') getData=: 3 : 0 Ticker=. y Cache=. jpath '~temp/',Ticker,'.csv' if. -. fexist Cache do. ('file';Cache)gethttp url Ticker 6!:3 ] 5 NB. wait 5 seconds for download to finish, otherwise there are errors end. fread Cache ) Maybe gethttp to stdo

[Jprogramming] Add vertical line to plot

2016-03-07 Thread Ryan Eckbo
I have a plot of a histogram, i.e. plot bins; counts to which I'd like to add a vertical line denoting the mean. I saw a post on how to create grid lines using complex numbers, but I don't know how to add a vertical line to an existing plot of data. Does anyone know how? Th

Re: [Jprogramming] Add vertical line to plot

2016-03-08 Thread Ryan Eckbo
et' pd (i.10); 5+*:i.10 pd 5 5;0 100 pd 'show' ... but if you wrap it in a verb, nobody will notice Ben ____ From: Programming [programming-boun...@forums.jsoftware.com] on behalf of Ryan Eckbo [ec...@cim.mcgill.ca] Sent: Tuesday, March 08,

[Jprogramming] Is variable defined

2016-03-10 Thread Ryan Eckbo
I seem to remember that there's a way to check whether a variable has been defined or not, but I can't find the method. Does anyone know? Thanks, Ryan -- For information about J forums see http://www.jsoftware.com/forums.htm

[Jprogramming] Displaying boxed tables

2016-03-29 Thread Ryan Eckbo
When I have large boxed tables, the rows wrap when they are displayed, making it hard to see what's going on. How can I change the formatting so that wrapping is turned off? Thanks, Ryan -- For information about J forum

Re: [Jprogramming] Displaying boxed tables

2016-03-30 Thread Ryan Eckbo
I was able to reduce the maximum line length using 9!:37 ] 0 180 8 8 (default is 0 256 0 222, where 256 is max line length). Now the lines don't wrap in my jconsole. Thanks! Ryan On 30 Mar 2016, at 17:30, robert therriault wrote: Ryan, I am not sure where you are seeing wrapping

[Jprogramming] regex - splitting a string on ^

2016-03-31 Thread Ryan Eckbo
his was previously a problem with rxrplc as well but was recently fixed. Is this also a bug with rxE? Thanks, Ryan -- For information about J forums see http://www.jsoftware.com/forums.htm

[Jprogramming] Plot not showing

2016-04-06 Thread Ryan Eckbo
I'm trying to plot one dashed line, but it seems to only work when more than one line is plotted. plottest=: 3 : 0 pd'reset' pd'penstyle 2 ' pd'pensize 2' pd y pd'show' ) plottest (i.10),:3+i.10 NB. two dashed lines plot

Re: [Jprogramming] Plot not showing

2016-04-07 Thread Ryan Eckbo
Henry's suggestion didn't work either. I'm using jconsole on a Mac: JVERSION Engine: j804/j64/darwin Release: commercial/2015-12-21 18:06:25 Library: 8.04.15 Platform: Darwin 64 Installer: J804 install InstallPath: /users/ryan/j64-804 Contact: www.jsoftware.com On 7 Apr 2016,