Outils pour utilisateurs

Outils du site


dse:data_query_for_loop

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
dse:data_query_for_loop [2024/05/28 20:12] – nicoantodse:data_query_for_loop [2025/03/13 13:41] (Version actuelle) – nicoanto
Ligne 1: Ligne 1:
 ====== DSE / Data Query / For Loop ====== ====== DSE / Data Query / For Loop ======
 +
 +===== Conversion d'une liste de tuples en Map de tuples =====
 +
 +<code>
 +/* Map yield ratio threshold data */
 +yield_ratio_threshold: Map<String, Tuple<matiere: String, min: Float, max: Float, average: Float>> = @yield_ratio_list.toMap(keyFunction: x => x.matiere, valueFunction: x => x);
 +</code>
  
 ===== Itération sur 2 tableaux de manière synchronisée ===== ===== Itération sur 2 tableaux de manière synchronisée =====
Ligne 8: Ligne 15:
 fusion:List<String>=List.range(startInclusive: 0, endExclusive: tableau1.length, step: 1 ) fusion:List<String>=List.range(startInclusive: 0, endExclusive: tableau1.length, step: 1 )
                   .map(index => tableau1[index] + "="+ tableau2[index]);                   .map(index => tableau1[index] + "="+ tableau2[index]);
 +</code>
 +
 +__Résultat__
 +<code>
 +["A=value A","B=value B","C=value C","D=value D"]
 +</code>
 +
 +===== Créer d'une matrice croisant 2 chaines de caractère =====
 +
 +<code>
 +term1:String="chien";
 +term2:String="niche";
 +matrix:List<List<String>>= List.range(0,term1.length)
 +    .map(index1 => List.range(0,term2.length)
 +        .map(index2 => term1.charAt(index1) + "-" +  term2.charAt(index2)
 +    )
 +) ;
 +
 +</code>
 +
 +__Résultat__
 +<code>
 +[["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"]]
 </code> </code>
dse/data_query_for_loop.1716927125.txt.gz · Dernière modification : (modification externe)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki