here is one wow verb
assign =: 4 : '(x) =: y'
stocklist =: 'DAL';'UAL' (NB. can do in console. later edit variable to
increase stocks). Can be used to add headers/titles too.
stocklist assign each quote each stocklist NB. only have to edit stocklist
once, and you will get new variable names.
DAL NB. assigned in previous statement
maybe a bit too much, but:
". each stocklist NB. will "run" the names of the variables previously assigned
(stocklist ,each 'd') assign each ([: |. }.)@: ". each stocklist NB. assigns
DALd and UALd
UALd
# UAL
2022
# UALd
2021
Prices=: [: ". &> 4&{"1
plot Prices UALd
plot Prices DALd
MaxPrice=: >./ @: Prices
MaxPrice each ". each stocklist
┌─────┬─────┐
│32.84│51.49│
└─────┴─────┘
stocklist,. MaxPrice each ". each stocklist NB. prettier display and
showing which ticker is which price
could reuse trick above:
(stocklist ,each 'p') assign each Prices@:". each stocklist ,each 'd' NB. UALp
and DALp are assigned
plot each ". each stocklist ,each 'p' NB. would repeat above 2 plots, and
simpler below (but this line works for any number of items in stocklist)
plot each UALp ; DALp
The wow punchline is that only stocklist need be changed to get specific whole
new variables, and stocklist can be very long.
----- Original Message -----
From: Joe Bogner <[email protected]>
To: [email protected]
Cc:
Sent: Monday, February 17, 2014 3:25:39 PM
Subject: Re: [Jprogramming] J in 5 minutes
On Mon, Feb 17, 2014 at 3:21 PM, Pascal Jasmin <[email protected]>wrote:
> If you post your script file, I'd be happy to suggest lines for the
> console.
>
>
Hi Pascal, I posted it to chat:
http://jsoftware.com/pipermail/chat/2014-February/005702.html
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm