Forum > Documentation (Maintaining -)

3.2 docs don't include new features

(1/2) > >>

segfault:
It seems the docs haven't been updated for 3.2, at least not the chm files. I was trying to find some examples of using the new insert, delete and concat functions for dynamic arrays, but there is nothing. Unless I'm looking in the wrong place?

marcov:
The CHM files are compiled from the same sources as the other docs.

Afaik the string versions have been updated to have both prototypes.

e.g. for delete, there is


--- Code: ---procedure Delete(
 
  var S: string;
 
  const Index: Integer;
 
  const Count: Integer
 
);

procedure Delete(
 
  var A: DynArrayType;
 
  const Index: Integer;
 
  const Count: Integer
 
);
 


--- End code ---

segfault:
Fair enough, it's just that there's no mention of the additions in 3.2 in the ref. manual in the section on dynamic arrays, just one example of using 'Copy' with them.
I was getting an error using concat when adding a single element to an array, then I realized the element should be surrounded by [] to denote an array, like you do with sets. It seems there are 3 ways (at least) of doing this :


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---{concatenate element to array} const  MAX = 5;type  intArray = array of integer;var  A : intArray;   i : integer; procedure output;begin  for i := low(A) to high(A) do    write(A[i]:3);end; begin  {method 1 - setlength}  for i := 1 to MAX do    begin    setlength(A, length(A) + 1);    A[high(A)] := random(10);    end;   output;   A := default(intArray);  writeln;   {method 2 - concat}  for i := 1 to MAX do    A := concat(A, [random(10)]);  output;   A := default(intArray);  writeln;   {method 3 - insert}  for i := 1 to MAX do    insert(random(10), A, length(A));  output;  writeln;end. 

Not sure whether they're equally efficient though.

marcov:
Yes, that is normal, it operates like all open array, see the corresponding item in the docs.

segfault:
But why does 'insert' not require the element to be enclosed in square brackets but 'concat' does? It seems a little inconsistent.

Navigation

[0] Message Index

[#] Next page

Go to full version