Jump to content

Wikifunctions:Project chat/Archive/2025/05

From Wikifunctions

Update language tag of "Simple English" (Z1124)

Please update the language tag of Z1124 to "en-simple" as the variant subtag "simple" is already registered in the Language Subtag Registry: https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry . -- Winston Sung (talk) 07:03, 13 May 2025 (UTC)

@Winston Sung: This can't be done until MediaWiki drops use of the tag, sorry. Jdforrester (WMF) (talk) 18:42, 14 May 2025 (UTC)
@Jdforrester (WMF):
MediaWiki no longer use en-x-simple but already use en-simple instead. -- Winston Sung (talk) 01:16, 15 May 2025 (UTC)
@Winston Sung: Ah, interesting, whoever did those changes didn't file a task with us. Will file one. Jdforrester (WMF) (talk) 11:36, 15 May 2025 (UTC)
Just note it here: the Phabricator task filed by @Jdforrester (WMF) is phab:T394401. -- Winston Sung (talk) 11:44, 15 May 2025 (UTC)
 :This section was archived on a request by: -- Winston Sung (talk) 11:55, 16 May 2025 (UTC)

Edit request - broken implementation

Please see Talk:Z19164#Edit request: implementation broken. I found a bug and wish to make a change, but I do not have permissions to do so. Thanks. --WrenFalcon (talk) 06:23, 15 May 2025 (UTC)

Thanks. It looks like this is now resolved. --99of9 (talk) 04:32, 16 May 2025 (UTC)
This section was archived on a request by: 99of9 (talk) 04:32, 16 May 2025 (UTC)

Wikifunctions & Abstract Wikipedia Newsletter #200 is out: Abstract Wikipedia is a MacArthur 100&Change finalist

There is a new update for Abstract Wikipedia and Wikifunctions. Please, come and read it!

In this issue, we announce that we reached the final stage of a grant competition, we introduce our next big conversation about where the content of Abstract Wikipedia will be located, and we take a look at the latest software developments.

Want to catch up with the previous updates? Check our archive!

Also, we remind you that if you have questions or ideas to discuss, the next Volunteers' Corner will be held on May 5, at 17:30 UTC (link to the meeting).

Enjoy the reading! -- User:Sannita (WMF) (talk) 10:57, 1 May 2025 (UTC)

This section was archived on a request by: Sannita (WMF) (talk) 13:57, 23 May 2025 (UTC)

Change to translatewiki.net-like/Miraheze-Meta-like page translation target languages

Currently, the page translation target language configuration on Wikifunctions were inherited from the "language converter page translation model".

However, this actually created several problems including the broken main page with malfunctioned language converter tags ( zh-Hans , zh-Hant , zh-Hant-HK ). More breakages could be found on phab:T328838.

As Wikifunctions haven't build up the large "tech debt", I would like to propose to use the "translatewiki page translation model"/"Miraheze Meta page translation model" instead on Wikifunctions.

This would also make the page translation target languages align with the ZObjects translation target languages.

-- Winston Sung (talk) 06:58, 13 May 2025 (UTC)

@Winston Sung: This sounds reasonable as an approach, thank you for flagging. Are there any community members here doing wikitext translation into multi-script languages who might have a view? Jdforrester (WMF) (talk) 18:46, 14 May 2025 (UTC)
Pinging @0xDeadbeef, @LowensteinYang, @MilkyDefer, @S8321414, @Stevenliuyi, @Supaplex, @星海子, @魔琴. -- Winston Sung (talk) 02:58, 15 May 2025 (UTC)
Cannot understand the technical configs and details. Just to say fixing it would be nice. 魔琴 (talk) 03:08, 15 May 2025 (UTC)
Please explain in detail about these translation models and their differences. I only see some configurations in your links and cannot grasp their differences. MilkyDefer 03:39, 15 May 2025 (UTC)
@MilkyDefer:
Below are examples of the proposed translation model.
Note: "translatewiki page translation model"/"Miraheze Meta page translation model" refer to the same translation model.
-- Winston Sung (talk) 03:44, 15 May 2025 (UTC)
Correct me if I am misunderstanding sth. The old configuration only has a blanket zh. The new configuration has zh-hans (for cn, my, sg), zh-hant (for tw) and zh-hk (for mo, hk). Is that right? MilkyDefer 11:49, 16 May 2025 (UTC)
That's correct for the zh/zh-* part. -- Winston Sung (talk) 11:54, 16 May 2025 (UTC)
If this issue can be fixed by changing translation model, I will Support Support--S8321414 (talk) 03:53, 15 May 2025 (UTC)
Done in Thursday, May 29, 2025 UTC morning backport window.
 :This section was archived on a request by: -- Winston Sung (talk) 08:16, 29 May 2025 (UTC)

Error in "is Jalali leap year"

Hi!

The correct implementation for this function should consider 4 as a leap year not 5. Otherwise the algorithm is correct. So it should be:

def Z11011(Z11011K1):
	year = int(Z11011K1)
	if(year <= 5):
		  mod = year % 4;
		  return (mod == 0);
	is_leap_year = (year % 33) in [1, 5, 9, 13, 17, 22, 26, 30]
	return is_leap_year

I didn't have permission to edit. How can I edit functions? Do I also need permission for function creation? Niyumard (talk) 12:02, 3 May 2025 (UTC)

I've just disconnected the Python implementation, so that you van edit it. An advice: create a testcase that the current implementation fails, so it's evident that there is a bug that should be corrected. Dv103 (talk) 12:05, 3 May 2025 (UTC)
I fixed the python code and added the test case that fails the JavaScript code. Can I disconnect the javascript code myself, or connect my own test cases or not, is there any guide for newbies? Niyumard (talk) 12:20, 3 May 2025 (UTC)
I've disconnected the js implementation.
Only Functioneers can connect and disconnect implementations and testcases, but everyone can create functions, testcases and implementations. This is described in the page Wikifunctions:Functioneers. Dv103 (talk) 12:26, 3 May 2025 (UTC)
I find it odd given the open nature of other wikis.
Done! And thanks a lot for your prompt reaction. Is this the correct place for asking Functioneers to connect and disconnect, or should I take my requests to some other place next time? Niyumard (talk) 12:32, 3 May 2025 (UTC)
It's mainly for security concerns (it's not wise to freely execute code uploaded by anyone). For now there is not a place specifically for requesting connections or disconnections (at least not that I am aware of), the closest page is Wikifunctions:Community portal. Dv103 (talk) 12:41, 3 May 2025 (UTC)
Makes sense. Thanks! Niyumard (talk) 12:49, 3 May 2025 (UTC)

Problems with evaluations: fixes are coming

Hi all, a quick update on the situation about evaluations not properly working in all cases, raised in the Telegram group. We identified the problem, and have been working in the last couple of weeks to solve it.

More specifically, you can find more info at phab:T393130 (some fixes already merged that should come up today, others will come in the next weeks), at phab:T392905 (fix already merged, should be up today), and at phab:T393152 (fix already merged, should be already up). We're also following phab:T391435 and phab:T392905.

If you have more malfunctions to report, please let me know here. Also, you can freely comment the Phab tickets to discuss directly with the engineers. Thanks for your attention! Sannita (WMF) (talk) 14:18, 7 May 2025 (UTC)

Fold and reduce swapped

Per my comments on Talk:Z876#Naming and WF:Catalogue/List operations#In-built functions with list outputs, I believe these functions' names are reversed from the conventional ones. Are there any FP greybeards who can confirm? YoshiRulz (talk) 05:22, 11 May 2025 (UTC)

I was involved in the construction of some of these, following suggestions from others. I have no particular expertise in the nomenclature, so may well have transmitted naming errors. Feel free to rename if others confirm your suggestion. --99of9 (talk) 12:44, 11 May 2025 (UTC)

Problems with a js implementation

Tracked in Phabricator:
Task T394663

The implementation Z24188 doesn't work (it fails a testcase), and I have no idea why. Is it a Wikifunctions bug or am I doing something wrong? Dv103 (talk) 10:44, 2 May 2025 (UTC)

I didn't see anything immediately wrong, and my attempt at Z24414 also fails. There are a lot of issues with lists and timeout/errors at the moment, but it appears that my changes have triggered it to go into infinite running mode https://phabricator.wikimedia.org/T392905. --99of9 (talk) 13:13, 2 May 2025 (UTC)
@Dv103 reported as phab:T394663 for investigation. --Denny (talk) 13:04, 19 May 2025 (UTC)
This section was archived on a request by: 99of9 (talk) 01:58, 11 June 2025 (UTC)

Internal server error in running a composition

I'm getting internal server errors in all testcases for chr(Nth element of codepoint list) (Z24456). Any idea why?
Also, is there some way to translate those oblique long Z-jsons you get as actual output into a way more human-readable form, like how normal objects are viewed on Wikifunctions? Aaron Liu (talk) 15:00, 3 May 2025 (UTC)

It's a problem that arises in get the nth element of a list (Z13397) (see testcase 3rd Code point of "Hello world!" (Z24458)). I don't know why. Dv103 (talk) 15:50, 3 May 2025 (UTC)
I filed a bug phab:T394664 for further investigation. --Denny (talk) 13:10, 19 May 2025 (UTC)
This section was archived on a request by: 99of9 (talk) 01:57, 11 June 2025 (UTC)

Smaller natural numbers

I want to use some number codes to represent an enum of 17 possible values. I find converting to and fro BigInt—the JS representation of the natural number type—bothersome, especially when 17 is the maximum number I need. Is there a representation of numbers that's analogous to an int8 or uint8?

Speaking of which, is there a list of types somewhere? Aaron Liu (talk) 17:06, 3 May 2025 (UTC)

Diving into things more: Is really every single number on Wikifunctions represented by a String? Parsing everything from and to ints seems quite inefficient and precluding some optimization. Aaron Liu (talk) 20:32, 3 May 2025 (UTC)
The simple answer is yes, since every type expands to values of other types, with only strings and references being the terminal types. The more complete answer in at Wikifunctions:Function model. Dv103 (talk) 21:34, 3 May 2025 (UTC)
That indeed explains how it is—that there are no canonical numbers. I've tried searching for why it is, though, and haven't found anything. Aaron Liu (talk) 22:11, 3 May 2025 (UTC)
It was done for simplification. If there are no built-in numbers, there are no built-in mathematics, and it can reduce the number of built-ins considerably. --Denny (talk) 13:11, 19 May 2025 (UTC)
You don't need to introduce built-in mathematics when introducing numbers either. There's like 2 built-in implementations for String functions. Aaron Liu (talk) 17:03, 19 May 2025 (UTC)
Yes, good point. I really wanted to keep the number of built-in types low, that's the main reason. And even for numbers we had quite a few decisions to make, so I think it is good we did that in the open and together through a type proposal. --Denny (talk) 12:57, 22 May 2025 (UTC)
There is no int8 type. The complete list of types is at . Dv103 (talk) 21:37, 3 May 2025 (UTC)
Ooh, lovely! Is there a way to bump the "Wikifunctions pages" section to the top of Special:SpecialPages? I decided to look under "Lists of pages" and couldn't find that. Aaron Liu (talk) 22:06, 3 May 2025 (UTC)
There's Byte (Z80) for u8. YoshiRulz (talk) 23:19, 3 May 2025 (UTC)
Thanks. I've checked that before, though. It is exactly the same as natural number and using it here would be semantically confusing. Aaron Liu (talk) 01:32, 4 May 2025 (UTC)
Enums should be represented as enums (e.g. such as Z16098) and not as numbers, ideally. Let me know what's blocking that. --Denny (talk) 13:28, 19 May 2025 (UTC)
I don't have the permissions to create types, so that's gonna take a long time if the (absence of) responses to Wikifunctions:Type proposals/Grapheme are anything to go by. Do you think I have a shot at getting functioneer? Aaron Liu (talk) 17:03, 19 May 2025 (UTC)
Enums usually go pretty fast (unless we are waiting for the light-weight enumerations, some of the current proposals are blocked on that). Even as a functioneer, one doesn't have type creation rights, these are currently limited to staff (type creation is currently not a user-friendly process, we want to improve that before opening that up). Yes, I would assume you have a good chance at becoming functioneer. --Denny (talk) 12:59, 22 May 2025 (UTC)
Ah, makes sense. Thanks! Aaron Liu (talk) 13:32, 22 May 2025 (UTC)
This section was archived on a request by: 99of9 (talk) 01:56, 11 June 2025 (UTC)

Taxon rank function(s)

I understand that function suggestions usually go in Wikifunctions:Suggest a function, but I could use some feedback on this, especially since I'm unsure of what Wikifunctions is capable of currently...

I think it would be useful to have a function that, given a Wikidata item that is an instance of taxonomic rank (Q427626) (hereafter a taxon rank), e.g. species (Q7432), genus (Q34740), family (Q35409), etc., returns whether or not that taxon rank is situated at or below the rank of genus. That is, it would return true for genus, subgenus, species, subspecies, variety, and botany's series, subseries, section, and subsection, among a handful of other infraspecific ranks (or infrageneric ranks that I may be forgetting about). For efficiency, it may be worth it to hard-code a partial list of taxon ranks that are considered to be at the generic level or below, and as a fallback traverse the taxon rank hierarchy by looking at the values of part of (P361). Here's a pseudocode example.

function genericRankOrLower(taxonRank) {
    const hardcodedGen = [
        'Qxxxxx', //species
        'Qxxxxx', //subgenus
        'Qxxxxx'  //genus
    ];
    const hardcodedNonGen = [
        'Qxxxxx', //family
        'Qxxxxx', //order
        'Qxxxxx', //class
        'Qxxxxx', //phylum
        'Qxxxxx'  //kingdom
    ];
    if (hardcodedGen.contains(taxonRank)) return true;
    if (hardcodedNonGen.contains(taxonRank)) return false; // want to avoid expensive long traversals

    let nextRank = WikidataLookup.GetFirst(item: taxonRank, property: P361);
    if (nextRank != null) return genericRankOrLower(nextRank);
    return false;
}

This would be useful because the names of taxa at the genus rank and lower should be italicized, but the names of taxa above the genus rank should not; e.g. the taxon name Eristalis stipator (Q13612717) may be written as Eristalis stipator or Eristalis (Eoseristalis) stipator (the subgenus, in parentheses, is optional), while the family name Syrphidae (Q217905) is written as Syrphidae. Wikispecies and the English Wikipedia have something that can help somewhat with this, species:Template:Taxon italics/en:Template:Taxon italics, which will correctly italicize a taxon name (including cases where there are unitalicized portions, such as "var."). However, I don't believe they have a Wikidata-enabled template or module for determining if a taxon should be italicized.

In the actual use of this proposed function, there may need to be exceptions or special cases for e.g. viruses - I am unfamiliar with the italicization rules for virus names. --WrenFalcon (talk) 20:02, 15 May 2025 (UTC)

Sounds like a good function suggestion to me. --99of9 (talk) 04:34, 16 May 2025 (UTC)
Thanks. I've added a suggestion at Wikifunctions:Suggest a function#Taxon functions - feel free to move it if necessary, as I'm not entirely sure where it fits best. --WrenFalcon (talk) 23:30, 16 May 2025 (UTC)
This section was archived on a request by: 99of9 (talk) 01:52, 11 June 2025 (UTC)

Just wonder, that fair use is allowed here or not?

Of course it doesn't seem allowed for files, as special:upload is disabled here, but how about functions or other text-like contents? Those may also be fair use-allowed on some certain projects (e.g. several Wikiquotes), m:Non-free_content#Other_projects only suggests "A new developing project, lack of discussions on this matter yet". Any inputs? --Liuxinyu970226 (talk) 01:12, 18 May 2025 (UTC)

Code contributions are licensed under Apache 2.0, and any contributions must be compatible with that license. Fair use and code are a complicated combination, that can be crucial in some cases (for example for header declarations), but I don't think that would cover whole function implementations copied from sources that are not Apache 2.0 compatible. I am not a lawyer, and if we want a proper answer involving lawyers, we can work towards that. Why are you asking, what's the idea you're mulling over? --Denny (talk) 13:44, 19 May 2025 (UTC)
@Liuxinyu970226: I see that you are the one who added that claim to the page on meta, nearly two years ago. I don't think it's correct; non-free content has never been allowed. Jdforrester (WMF) (talk) 16:18, 19 May 2025 (UTC)
Somewhat modified, but looks still vague even for me... Liuxinyu970226 (talk) 21:46, 19 May 2025 (UTC)
Thanks for your edit! Jdforrester (WMF) (talk) 21:11, 21 May 2025 (UTC)
This section was archived on a request by: 99of9 (talk) 01:51, 11 June 2025 (UTC)

Request for connecting implementations

Could a functioneer take a look at Z15362/nth prime and Z24716/bitwise NAND and consider revising the respective lists of connected implementations?

Z15362/nth prime: I'd recommend connecting Z24783/nth prime, caching primes and Z24784/nth prime, caching primes, JS, as these seem to be the fastest - they pass all the tests, whereas the others time out on at least one. It should also be noted that these two implementations use more memory than the other implementations, but it doesn't seem to have a particularly noticeable effect on the memory usage.

Z24716/bitwise NAND: I'd like to see Z24780/bitwise NAND, javascript connected. I understand that there's a potential performance benefit when multiple implementations used in a call share the same programming language (though this may not be the case at current), so it would be beneficial to have implementations in all supported programming languages, where possible.

Thanks. --WrenFalcon (talk) 05:02, 24 May 2025 (UTC)

All Done. Thanks for the work! ~/Bunnypranav:<ping> 06:02, 24 May 2025 (UTC)
This section was archived on a request by: 99of9 (talk) 01:51, 11 June 2025 (UTC)

proposed Read and Display functions for Unicode code point

I suggest we use the following functions as a read and display function for the Unicode code point Type:

The reader is intended to be as lenient as possible. If there are other possible input formats, feel free to extend it to include them.

The display uses U+FFFF notation. We have choice here. I picked this because it seems to be common and unambiguous. I'm happy to use another convention if others want it.

Feel free to add an implementation to either with a language configuration if you would like to convert to a different numeral script. --99of9 (talk) 03:01, 27 May 2025 (UTC)

Thank you! Done as per this edit. Looks great!
I was just hoping this week for having this type with a read and display function! This is awesome! --DVrandecic (WMF) (talk) 12:01, 27 May 2025 (UTC)
Your work on number of bytes for code point in UTF-8 (Z24809) reminded me to finish this off. Last time I'd worked on it I had done almost everything but had been uncertain about which display format to use. Coming back to it the answer seemed clear. --99of9 (talk) 12:37, 27 May 2025 (UTC)
@99of9 Ha! It was exactly writing the tests for that function which made me wish there was this display and read function! --DVrandecic (WMF) (talk) 10:03, 2 June 2025 (UTC)
This section was archived on a request by: 99of9 (talk) 01:50, 11 June 2025 (UTC)