[Lazarus] Generics diffence between Lazarus and Delphi Berlin

Andreas Frieß friess at gmx.at
Tue Feb 28 09:37:19 CET 2017


I have found some interesting working Generics construct. I want to 
translate this code to Lazarus, but there are Generics often used.
In Delphi Berlin the following ist working, the inner array of Integer 
is normally 6 integer long, but once 7 integer and can filled in such 
way. Is it possible to do something similar in Lazarus ? Or how can i 
rewrite this to to the same in Lazarus/FPC

Andreas

var
   CODE_PATTERNS: TArray<TArray<Integer>>;
........

   CODE_PATTERNS :=  [[2, 1, 2, 2, 2, 2], // 0
   [2, 2, 2, 1, 2, 2], [2, 2, 2, 2, 2, 1], [1, 2, 1, 2, 2, 3],
     [1, 2, 1, 3, 2, 2], [1, 3, 1, 2, 2, 2], // 5
   [1, 2, 2, 2, 1, 3], [1, 2, 2, 3, 1, 2], [1, 3, 2, 2, 1, 2],
     [2, 2, 1, 2, 1, 3], [2, 2, 1, 3, 1, 2], // 10
   [2, 3, 1, 2, 1, 2], [1, 1, 2, 2, 3, 2], [1, 2, 2, 1, 3, 2],
     [1, 2, 2, 2, 3, 1], [1, 1, 3, 2, 2, 2], // 15
   [1, 2, 3, 1, 2, 2], [1, 2, 3, 2, 2, 1], [2, 2, 3, 2, 1, 1],
     [2, 2, 1, 1, 3, 2], [2, 2, 1, 2, 3, 1], // 20
   [2, 1, 3, 2, 1, 2], [2, 2, 3, 1, 1, 2], [3, 1, 2, 1, 3, 1],
     [3, 1, 1, 2, 2, 2], [3, 2, 1, 1, 2, 2], // 25
   [3, 2, 1, 2, 2, 1], [3, 1, 2, 2, 1, 2], [3, 2, 2, 1, 1, 2],
     [3, 2, 2, 2, 1, 1], [2, 1, 2, 1, 2, 3], // 30
   [2, 1, 2, 3, 2, 1], [2, 3, 2, 1, 2, 1], [1, 1, 1, 3, 2, 3],
     [1, 3, 1, 1, 2, 3], [1, 3, 1, 3, 2, 1], // 35
   [1, 1, 2, 3, 1, 3], [1, 3, 2, 1, 1, 3], [1, 3, 2, 3, 1, 1],
     [2, 1, 1, 3, 1, 3], [2, 3, 1, 1, 1, 3], // 40
   [2, 3, 1, 3, 1, 1], [1, 1, 2, 1, 3, 3], [1, 1, 2, 3, 3, 1],
     [1, 3, 2, 1, 3, 1], [1, 1, 3, 1, 2, 3], // 45
   [1, 1, 3, 3, 2, 1], [1, 3, 3, 1, 2, 1], [3, 1, 3, 1, 2, 1],
     [2, 1, 1, 3, 3, 1], [2, 3, 1, 1, 3, 1], // 50
   [2, 1, 3, 1, 1, 3], [2, 1, 3, 3, 1, 1], [2, 1, 3, 1, 3, 1],
     [3, 1, 1, 1, 2, 3], [3, 1, 1, 3, 2, 1], // 55
   [3, 3, 1, 1, 2, 1], [3, 1, 2, 1, 1, 3], [3, 1, 2, 3, 1, 1],
     [3, 3, 2, 1, 1, 1], [3, 1, 4, 1, 1, 1], // 60
   [2, 2, 1, 4, 1, 1], [4, 3, 1, 1, 1, 1], [1, 1, 1, 2, 2, 4],
     [1, 1, 1, 4, 2, 2], [1, 2, 1, 1, 2, 4], // 65
   [1, 2, 1, 4, 2, 1], [1, 4, 1, 1, 2, 2], [1, 4, 1, 2, 2, 1],
     [1, 1, 2, 2, 1, 4], [1, 1, 2, 4, 1, 2], // 70
   [1, 2, 2, 1, 1, 4], [1, 2, 2, 4, 1, 1], [1, 4, 2, 1, 1, 2],
     [1, 4, 2, 2, 1, 1], [2, 4, 1, 2, 1, 1], // 75
   [2, 2, 1, 1, 1, 4], [4, 1, 3, 1, 1, 1], [2, 4, 1, 1, 1, 2],
     [1, 3, 4, 1, 1, 1], [1, 1, 1, 2, 4, 2], // 80
   [1, 2, 1, 1, 4, 2], [1, 2, 1, 2, 4, 1], [1, 1, 4, 2, 1, 2],
     [1, 2, 4, 1, 1, 2], [1, 2, 4, 2, 1, 1], // 85
   [4, 1, 1, 2, 1, 2], [4, 2, 1, 1, 1, 2], [4, 2, 1, 2, 1, 1],
     [2, 1, 2, 1, 4, 1], [2, 1, 4, 1, 2, 1], // 90
   [4, 1, 2, 1, 2, 1], [1, 1, 1, 1, 4, 3], [1, 1, 1, 3, 4, 1],
     [1, 3, 1, 1, 4, 1], [1, 1, 4, 1, 1, 3], // 95
   [1, 1, 4, 3, 1, 1], [4, 1, 1, 1, 1, 3], [4, 1, 1, 3, 1, 1],
     [1, 1, 3, 1, 4, 1], [1, 1, 4, 1, 3, 1], // 100
   [3, 1, 1, 1, 4, 1], [4, 1, 1, 1, 3, 1], [2, 1, 1, 4, 1, 2],
     [2, 1, 1, 2, 1, 4], [2, 1, 1, 2, 3, 2], // 105
   [2, 3, 3, 1, 1, 1, 2]];



More information about the Lazarus mailing list