Jump to content

Abstract Wikipedia/Updates/2024-01-03

From Meta, a Wikimedia project coordination wiki
Abstract Wikipedia Updates Translate

Abstract Wikipedia via mailing list Abstract Wikipedia on IRC Wikifunctions on Telegram Wikifunctions on Mastodon Wikifunctions on Twitter Wikifunctions on Facebook Wikifunctions on YouTube Wikifunctions website Translate

Introducing our first new type: Lists

[edit]

When Wikifunctions was made publicly available last year, we supported only two types: Strings and Booleans.

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:

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. 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.

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.

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?

[edit]

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?

[edit]

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

[edit]

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.