fork download
  1. procedure main()
  2. ary := [2,3,5,7,11]
  3. write(inspect(ary));
  4.  
  5. ary := list(10, 1)
  6. write(inspect(ary));
  7.  
  8. ary := list(10)
  9. write(inspect(ary));
  10.  
  11. every i := 1 to *ary do ary[i] := i
  12. write(inspect(ary));
  13.  
  14. mat := make_matrix(4, 0.0);
  15. write(inspect(mat))
  16. end
  17.  
  18. procedure inspect(arg)
  19. result := "[ "
  20. every elt := !arg do
  21. if type(elt) == "list" then
  22. result ||:= inspect(elt) || ", "
  23. else
  24. result ||:= image(elt) || ", "
  25. return result || "]"
  26. end
  27.  
  28. procedure make_matrix(n, x)
  29. L := list(n)
  30. every !L := list(n, x)
  31. return L
  32. end
Success #stdin #stdout 0.01s 5248KB
stdin
Standard input is empty
stdout
[ 2, 3, 5, 7, 11, ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ]
[ &null, &null, &null, &null, &null, &null, &null, &null, &null, &null, ]
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ]
[ [ 0.0, 0.0, 0.0, 0.0, ], [ 0.0, 0.0, 0.0, 0.0, ], [ 0.0, 0.0, 0.0, 0.0, ], [ 0.0, 0.0, 0.0, 0.0, ], ]