The on-wiki version of this newsletter can be found here: https://www.wikifunctions.org/wiki/Wikifunctions:Status_updates/2024-05-10 -- Flagship type for enumerations: Months of the Gregorian calendar https://www.wikifunctions.org/wiki/File:Plates_of_the_Twelve_Lunar_Months_LACMA_M.84.64.1-.12_(1_of_2).jpg*Plates of the Twelve Lunar Months, Ogata Kenzan (Japan, 1663-1743)*
As we announced last week https://www.wikifunctions.org/wiki/Wikifunctions:Status_updates/2024-05-03, our work for this quarter includes developing type support for enumerations https://phabricator.wikimedia.org/T363390. An enumeration is a type consisting of a set of named instances. Unlike open types such as natural number https://www.wikifunctions.org/view/en/Z13518 or string https://www.wikifunctions.org/view/en/Z6, 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 https://www.wikifunctions.org/view/en/Z40 (with the two values true https://www.wikifunctions.org/view/en/Z41 and false https://www.wikifunctions.org/view/en/Z42) and natural languages https://www.wikifunctions.org/view/en/Z60 (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 https://www.wikifunctions.org/view/en/Z13518, we chose a flagship type to go as the first new enumeration type: months of the Gregorian calendar https://www.wikifunctions.org/wiki/Wikifunctions:Type_proposals/Gregorian_calendar_month. 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. Abstract Wikipedia at the Hackathon
Our tech lead, James https://www.wikifunctions.org/wiki/User:Jdforrester_(WMF), attended the annual Wikimedia Hackathon https://www.mediawiki.org/wiki/Wikimedia_Hackathon_2024 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. Recent Changes in the software
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 https://phabricator.wikimedia.org/T359035). We fixed a missed piece of internationalisation in the aria-label of the Toggle button, for screen readers and other assistive devices (T362056 https://phabricator.wikimedia.org/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 https://phabricator.wikimedia.org/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 https://www.wikifunctions.org/wiki/Wikifunctions:Project_chat or file a Phabricator task https://phabricator.wikimedia.org/project/view/4876/ if you spot an issue. Volunteers' Corner on May 6th
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 https://www.wikifunctions.org/view/en/Z15982. The recording of the event is available on Wikimedia Commons https://commons.wikimedia.org/wiki/File:Abstract_Wikipedia_Volunteer_Corner_2024-05.webm . Function of the Week: Binomial Coefficient (Z13848)
Binomial coefficients https://en.wikipedia.org/wiki/Binomial_coefficient 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. https://www.wikifunctions.org/wiki/File:Wikifunctions_binomial_function_result_snapshot.png
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:
1. Red and Blue 2. Red and Green 3. Red and Yellow 4. Red and Orange 5. Blue and Green 6. Blue and Yellow 7. Blue and Orange 8. Green and Yellow 9. Green and Orange 10. Yellow and Orange
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” https://www.wikifunctions.org/view/en/Z13848.
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: (nk) = n!/(n-k)!
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 https://www.wikifunctions.org/view/en/Z13667, too, which is used in one of the compositions https://www.wikifunctions.org/view/en/Z13907.
The binomial coefficient function on Wikifunctions has 4 implementations – 2 compositions, and 2 implementations in Python :
- binomial composition via factorial https://www.wikifunctions.org/view/en/Z13907, as just mentioned - binomial coefficient, python https://www.wikifunctions.org/view/en/Z13850, looping for a factorial - binomial recursive composition https://www.wikifunctions.org/view/en/Z13912 - binomial coefficient, python https://www.wikifunctions.org/view/en/Z14852 (using math.comb from the standard library)
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.