La fonction listContains()
juge si une liste contient un élément particulier, retourne 1 pour 'oui' et 0 pour 'non'.
Arguments:
- Liste
- Élément
Retours:
- 1 ou 0
Utilisation Courante
Exemple : Calcul direct
uncollect [[1,2,3],[2,4,5]] as a
uncollect [3,4] as b
return table(toString(a), b, listContains(a, b))
| toString(a) | b | listContains(a, b) |
|-------------|---|--------------------|
| [1,2,3] | 3 | 1 |
| [2,4,5] | 4 | 1 |
Exemple : Multiplier et calculer
uncollect [[1,2,3],[2,4,5]] as a
uncollect [3,4] as b
with listContains(a, b) as c
return table(toString(a), b, c)
| toString(a) | b | c |
|-------------|---|---|
| [1,2,3] | 3 | 1 |
| [1,2,3] | 4 | 0 |
| [2,4,5] | 3 | 0 |
| [2,4,5] | 4 | 1 |