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
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
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
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
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
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
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
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
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
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
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
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:
>
>&
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
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
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
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
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
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
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
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
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
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
---
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
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
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
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
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
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
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=
: (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
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
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:
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
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
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
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
-
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
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
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
; 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
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
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=:
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)
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
>
>
>
&
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
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
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
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
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_ '
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.
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
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
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:
>
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
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
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,
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
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
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
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
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
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,
62 matches
Mail list logo