Wikipédia abstraite/Mises à jour/2024-01-03
◀ | Actualités de la Wikipédia abstraite | ▶ |
Introduction de notre premier nouveau type : les listes
Lorsque Wikifonctions a été rendue publique l’année dernière, nous n’avions que deux types : les chaînes et les booléens.
Nous sommes heureux d’annoncer le premier nouveau type désormais disponible et utilisable par la communauté : les listes.
Qu’est-ce qu’une liste ? Une liste est une valeur composée de plusieurs éléments, généralement du même type. Peu importe le nombre d'éléments de la liste ; vous n’avez pas besoin de le savoir à l’avance. Vous pouvez ajouter plus d’éléments à une liste, vous pouvez supprimer des éléments d’une liste, vous peut récupérer des parties d’une liste ou regarder un élément individuel à l’intérieur de la liste. Il y a beaucoup plus de choses que vous pouvez faire avec des listes.
Il existe cinq fonctions prédéfinies qui sont immédiatement disponibles pour les listes :
- Ajouter un élément au début de la liste
- Prendre le premier élément d’une liste
- Retourner une liste sans son premier élément
- Vérifier si une liste est vide
- Vérifier si deux listes sont identiques
Les listes permettent de lire et d’écrire beaucoup plus facilement un certain nombre de compositions.
This is useful for natural language functions. For example, we have a function that checks whether a Breton word needs to mutate. The composition features a series of “ors”: does the word start with a k, or does the word start with a t, or does the word start with a p, or does the word start with a g, etc.
Instead, we can now create an implementation that asks “does the word start with one of the strings from this list?”, which becomes both easier to write, read, and maintain than the previous implementation.
Lists can be used in four different forms for now:
- You can have a list of Strings, as we have seen in the example above;
- You can have a list of Booleans;
- You can have a list of Objects, which allows you to mix the types of the elements in the list (because everything is an Object); or
- You can have a list of lists.
This is possible because we implemented lists as so-called generic types: instead of having four distinct types on Wikifunctions, there is a function that takes an element type as input, and returns a list type.
This also means that when we introduce the next type, you will automatically be able to use lists with elements of that type, as one will be able to specify the new type as the argument of the typed list function.
What’s next with types?
Although there are a few more generic types that we want to support —and, eventually, allow you to create new generic types— we will now focus on a few simpler types first. It will likely be a while before we come back to generic types. The next type we plan to support is for natural numbers, and we expect that to be sooner than later.
What’s next this year?
The team will soon have its planning session for the new half-year period. We will then announce our plans, and let you know what to expect.
Recent changes in the software
Since the last update, mostly the team has been off celebrating the various end-of-Western-year / solstice-related holidays.
Our focus has been on supporting custom Types (T343469), discussed above. We landed the new "mode selector" front-end control which lets you specify a "type" as a function call, such as the one to make a list. It lets you specify the type used in a list, either as a referenced type such as string or a function call that produces a type, such as typed list. New entries in the list are automatically added in the specified type; if the specified type is just the fallback "object", you can over-ride it to be more specific for each entry. Happy hacking!
We fixed the label in the function editor for outputs, which was calling it an 'input' instead (T348363); this was the first commit for Wikifunctions from community member User:Punith.nyk, thank you! We also fixed a couple of bugs that made lists not work correctly in some circumstances. Over the holiday period, several dozen more software labels were translated into new languages, meaning we're currently 90%+ translated in nine languages beyond English (Hebrew, Interlingua, Dutch, Slovenian, German, French, Polish, Turkish, and Swedish); our thanks as always go to the TranslateWiki.net community.
On the back-end, we've been working to simplify our test suites and benchmarking code that has grown to be quite elaborate over the years, plus continuing our back-end support work for custom types, and improving the quality of errors the system can return in different situations.