/* Create a two-dimensional array at runtime in Picat. http://rosettacode.org/wiki/Create_a_two-dimensional_array_at_runtime#BQN """ Get two integers from the user, then create a two-dimensional array where the two dimensions have the sizes given by those numbers, and which can be accessed in the most natural way possible. Write some element of that array, and then output that element. Finally destroy the array if not done by the language itself. """ This program was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import util. main => go. go => [Rows,Cols]=split("10 10").map(to_int), X=new_array(Rows,Cols), X[1,1] = 123, println(X[1,1]), nl. % interactive go2 => print("Input the number of rows and columns: "), [Rows,Cols]=split(read_line()).map(to_int), X=new_array(Rows,Cols), X[1,1] = Rows*Cols+1, println(X[1,1]), nl.