1
$\begingroup$

I have a list with stock index data (which I load from a database) as follows:

lis={{{2000,01,03,^AEX", 4470}, {2000,01,05, ^AEX, 4470}}, 
    {{2000,01,04, ^AFLI, 4471}, {2000,01,05, ^AFLI, 4471}},
    {{2000,01,03,^AORD, 4472}, {2000,01,05, ^AORD, 4472}}}

I would like to update the database. For that purpose I need the date of the last database entry per symbol. I use the following function:

updateParameter =
 Map[
  Flatten[{
     Last[Transpose[#][[1]]],
     #[[1, 2]],
     #[[1, 3]]
     }] &, lis]

It provide the desired result:

{{2015,01,05, ^AEX, 4470}, {2015,01,05, ^AFLI, 
  4471}, {2015,01,05, ^AORD, 4472}}

But my function seems to be a little bit awkward. I´m sure there is a more "elegant" way. Does anyone have a hint?

$\endgroup$

closed as off-topic by ciao, Karsten 7., xyz, ubpdqn, bbgodfrey Apr 5 '15 at 11:38

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – ciao, Karsten 7., xyz, ubpdqn, bbgodfrey
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ lis[[All, -1]] will give you same result... $\endgroup$ – ciao Apr 5 '15 at 6:32

Browse other questions tagged or ask your own question.