====== DSE / Data Query / For Loop ====== ===== Conversion d'une liste de tuples en Map de tuples ===== /* Map yield ratio threshold data */ yield_ratio_threshold: Map> = @yield_ratio_list.toMap(keyFunction: x => x.matiere, valueFunction: x => x); ===== Itération sur 2 tableaux de manière synchronisée ===== tableau1:List=["A", "B", "C", "D"]; tableau2:List=["value A", "value B", "value C", "value D"]; fusion:List=List.range(startInclusive: 0, endExclusive: tableau1.length, step: 1 ) .map(index => tableau1[index] + "="+ tableau2[index]); __Résultat__ ["A=value A","B=value B","C=value C","D=value D"] ===== Créer d'une matrice croisant 2 chaines de caractère ===== term1:String="chien"; term2:String="niche"; matrix:List>= List.range(0,term1.length) .map(index1 => List.range(0,term2.length) .map(index2 => term1.charAt(index1) + "-" + term2.charAt(index2) ) ) ; __Résultat__ [["c-n","c-i","c-c","c-h","c-e"],["h-n","h-i","h-c","h-h","h-e"],["i-n","i-i","i-c","i-h","i-e"],["e-n","e-i","e-c","e-h","e-e"],["n-n","n-i","n-c","n-h","n-e"]]