Hi,
I’ve only recently gotten into J. It’s very interesting but I’m often unable
to find simple solutions to simple problems. I’m now struggling with finding a
way of taking a table and a vector and picking elements from the table with
positions in rows according to the vector, that is, the i-t
vec {"0 1 tab
or, simpler & more general,
vec {"_1 tab
-Dan
Please excuse typos; composed on a handheld device.
-Original Message-
From: Roman Odaisky
Date: Sat, 22 May 2010 17:17:33
To:
Subject: [Jprogramming] An element from each row of a table
Hi,
I’ve only recently gotten in
I have implemented Jtangle (which extracts J code from JWiki pages) in J.
http://www.jsoftware.com/jwiki/AndrewNikitin/Jtangle
I also used it as a hack to load (which hack is described in
http://www.jsoftware.com/jwiki/AndrewNikitin/loadlit
The abridged verson is this:
Performing extra
table =: 5 4 $ i. 20
positions =: 0 2 0 1 2
(0 0;1 2;2 0;3 1;4 2){table
0 6 8 13 18
(i.5),&.> positions
┌───┬───┬───┬───┬───┐
│0 0│1 2│2 0│3 1│4 2│
└───┴───┴───┴───┴───┘
((i.5),&.> positions){table
0 6 8 13 18
2010/5/22 Roman Odaisky :
> Hi,
>
> I’ve only recently gotten into J.
5 4 $ i.20 can be given as i.5 4
Dan's method is better, but the following also works:
0 2 0 1 2 } |: i.5 4
0 6 8 13 18
On Sat, May 22, 2010 at 10:22 PM, Dan Bron wrote:
> vec {"0 1 tab
> or, simpler & more general,
> vec {"_1 tab
>
> -Dan
>
> Please excuse typos; composed on a handheld d
Darn! When I saw the title, I thought this was about linear programming...
Maybe this will convince me to give literate programming another look.
On Sat, May 22, 2010 at 7:29 PM, Andrew Nikitin wrote:
>
> I have implemented Jtangle (which extracts J code from JWiki pages) in J.
>
> http://www.