The on-wiki version of this newsletter can be found here:
https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Updates/2024-01-03
Due to the images it might be easier to read this on-wiki.
--Introducing our first new type: Lists
When Wikifunctions was made publicly available last year, we supported only
two types: Strings and Booleans.
<https://meta.wikimedia.org/wiki/File:Composition_with_or.png>Composition
with several "or"s.
We are happy to announce that the first new type is now available for use
by the community: Lists.
What is a list? A list is a value that consists of a number of elements,
usually of the same type. It doesn’t matter how many elements there are in
the list; you don’t have to know in advance. You can add more elements to a
list, you can remove elements from a list, you can pick up parts of a list,
or look at an individual element inside the list. There are many more
things you can do with lists.
There are five pre-defined functions that are available right away for
lists:
- Add an element <https://www.wikifunctions.org/wiki/Z810> to the
beginning of a list
- Look at the first element <https://www.wikifunctions.org/wiki/Z811> of
a list
- Return a list without its first element
<https://www.wikifunctions.org/wiki/Z812>
- Check whether a list is empty <https://www.wikifunctions.org/wiki/Z813>
- Check if two lists are the same
<https://www.wikifunctions.org/wiki/Z889>
Lists make a number of compositions much easier to read and write.
This is useful for natural language functions. For example, we have a
function that checks whether a Breton word needs to mutate
<https://www.wikifunctions.org/wiki/Z11595>. The composition
<https://www.wikifunctions.org/wiki/Z11601> features a series of “ors
<https://www.wikifunctions.org/wiki/Z10184>”: 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?
<https://wikifunctions.beta.wmflabs.org/view/en/Z11538>”, which becomes
both easier to write, read, and maintain than the previous implementation.
<https://meta.wikimedia.org/wiki/File:Composition_with_list.png>Composition
using a list.
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
<https://www.wikifunctions.org/wiki/Z881>.
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
<https://meta.wikimedia.org/wiki/Abstract_Wikipedia/Updates/2023-12-13>,
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
<https://phabricator.wikimedia.org/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
<https://www.wikifunctions.org/wiki/Z6> or a function call that produces a
type, such as typed list <https://www.wikifunctions.org/wiki/Z881>. 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 <https://phabricator.wikimedia.org/T348363>);
this was the first commit for Wikifunctions from community member
User:Punith.nyk <https://www.wikifunctions.org/wiki/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
<https://translatewiki.net/wiki/Special:MessageGroupStats?group=ext-wikilambda-user&messages=&language=en-gb&x=D#sortable:3=desc>
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.