As we announced last week, our work for this quarter includes developing type support for enumerations. An enumeration is a type consisting of a set of named instances. Unlike open types such as natural number or string, which can be created on the fly and can have an arbitrary number of instances, an enumeration must have all its instances predefined. In Wikifunctions, all instances of an enumeration must have distinct ZIDs and are distinct objects.
We already have a few types which could be regarded as enumerations, such as Booleans (with the two values true and false) and natural languages (with currently hundreds of values). We will want many more enumerations in Wikifunctions, be it for the sign of a number, weekdays, cardinal directions, and much more. For natural language generation, we will need it to represent grammatical features, such as grammatical number, which we need for the function we worked together on in this week’s Volunteers’ Corner (see below).
Just like last quarter with natural numbers, we chose a flagship type to go as the first new enumeration type: months of the Gregorian calendar. The community is invited to join the discussion of the specification: should this also encompass the Julian calendar? Is there a good name for a single type that covers both? What other considerations are there?
We would also like to ask the community to prepare and discuss similar enumerations for other calendar systems, so that, once this type works, we can move swiftly to create them in order to have parity across the world's calendar systems.
Our tech lead, James, attended the annual Wikimedia Hackathon as a volunteer last weekend, which took place in Tallinn, Estonia. He was glad to meet several existing Wikifunctions community members, and help explain the Wikifunctions and Abstract Wikipedia visions. There were extensive discussions about linguistic variations and how our community might hope to model them in forthcoming language generation functions. It was his pleasure to assist someone making their very first function, even though technical issues meant it didn't work at first. He and the rest of the team looks forward to speaking with more people about Wikifunctions.
Over the past two weeks, we've focused on the areas we laid out last week – Identity support on Types, production observability improvements, multi-language interface design improvements, research for the future Wikipedia integration, and much more.
Beyond that work, we've made a few minor improvements that some of you may notice. We adjusted the front-end to batch requests for objects, grabbing at most 50 items at once, rather than unlimited; though in practice we've not hit this yet, in the future as community-written functions get more complex, this would have been reached and caused odd breakages in the front-end (T359035). We fixed a missed piece of internationalisation in the aria-label of the Toggle button, for screen readers and other assistive devices (T362056).
We consolidated our duplicate maintenance scripts for managing pre-defined Objects, merging reloadBuiltinData into loadPreDefinedObject. We added the last remaining feature from the internal ApiQueryZObjects Action API to the new Fetch REST API, which will allow us to migrate to these cheaper, faster calls in future (T274269).
All Wikimedia-deployed code is using the latest version of the Codex UX library, v1.5.0, as of this week. Though we do not believe the library upgrade will have any user-visible changes in our use on Wikifunctions, please comment on the Project chat or file a Phabricator task if you spot an issue.
We met with some of our wonderful Wikifunctions volunteers on Monday. We discussed our work for this quarter in more detail and built a function together for language-specific numerical singulars and plurals. The recording of the event is available on Wikimedia Commons.
Binomial coefficients represent the number of ways you can choose a certain number of items from a larger set, regardless of the order. They're often represented as "n choose k", where n is the total number of items and k is the number of items to choose.
For example, imagine we have five beads of different colors (Red, Blue, Green, Yellow, Orange), and we want to randomly choose two beads from them at a time. The binomial coefficient "5 choose 2" would tell us how many different pairs of beads we can make. In this case, it would be 10 pairs:
So, binomial coefficients help you figure out how many combinations you can make from a set of items. The image shows our function returning a result of 10 for “5 choose 2”.
Mathematically speaking, the binomial coefficient, often denoted as (nk), represents the number of ways to choose k items from a set of n distinct items, without considering their order. It's calculated using the formula:
Where n! (read as "n factorial") denotes the product of all positive integers up to n, and k! is the factorial of k, and so on. We have a function for the factorial, too, which is used in one of the compositions.
The binomial coefficient function on Wikifunctions has 4 implementations – 2 compositions, and 2 implementations in Python :
Binomial coefficients find their practical uses in probability predictions, to find the chance of getting a specific number of successes in a series of trials with only two possible outcomes or the likelihood of winning the lottery, or combinatorics , to count different ways to arrange or choose things, like distributing items into groups or selecting members for a committee.