3

How would I create a nested array in Asymptote such as [[1,2,3],[4,5,6]] and call upon element 1 of array 1 and such?

  • 1
    Does the discussion in section 2.15 of this nice tutorial help? – user121799 Feb 9 '19 at 20:13
  • Kind of, but I still don't fully understand the syntax. How would you define such an array such as my example [[1,2,3],[4,5,6]] above? – James Palmer Feb 9 '19 at 20:40
  • 2
    Generally you are much more likely to get a concrete answer if you post a concrete question. In your case this would be an asymptote code that attempts to use an array. Then the one who is willing to write an answer will know whether you are talking about integers or reals and so on, and in particular does not have to type so much themselves. – user121799 Feb 9 '19 at 21:51
  • 4
    Note to close/reopen-voters: Asymptote (like Metapost) is part of the TeX ecosystem even though its syntax does not resemble standard TeX syntax. See tex.meta.stackexchange.com/questions/3518/…. Also note that the Asymptote tag has 7 questions on Stackoverflow versus 403 on TeX.SX. – Charles Staats Feb 10 '19 at 1:39
6

Illustration in interactive mode:

$ asy
Welcome to Asymptote version 2.41 (to view the manual, type help)
> int[][] a = {{1,2,3},{4,5,6}};
> a  // please print a
1   2   3
4   5   6
> a[1][1]  // index-1 entry of index-1 array in a
5
> a[1]  // index-1 array in a
0:  4
1:  5
2:  6
  • 2
    Nice to see you back! And I fully agree with your above comment. – user121799 Feb 10 '19 at 3:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.