Wikifunctions talk:Introduction
How to run a function?
If I make a new function & add an implementation, I can't seem to run it.
If I edit an existing implementation somewhere, I can run that immediately, so why is there a discrepancy? Racecard (talk) 06:37, 14 December 2023 (UTC)
- Hello @Racecard, I need more information about what you are experiencing. Can you point me to the function you created and to the function you edited? Can you repeat to me step-by-step the actions, so that we can define if it's a problem of permissions or if it's a bug? Thanks in advance! Sannita (WMF) (talk) 16:46, 15 December 2023 (UTC)
Create a new function for use in your own implementations
Maybe I'm misunderstanding something, but this sounds a bit awkward: "Create a new function for use in your own implementations".
Perhaps it can be something like "Create a new function and add your own implementations"? Amir E. Aharoni (talk) 19:28, 29 July 2024 (UTC)
"Select Function"
I'm trying to go through the "Create a test" steps, and something looks inconsistent.
- Find a function on the Main Page: I picked Z13163.
- Navigate to the function page: OK.
- Click the “+” link in the tests table: OK, got to https://www.wikifunctions.org/w/index.php?title=Special:CreateObject&uselang=en&zid=Z20&Z20K1=Z13163
- Click on "Select Function" under "Call": Here it starts getting weird. There is nothing with the label "Select Function". What I do see there is this: "call; get day of week from date; (Natural number ("")), Select Gregorian calendar month, Natural number (""))". Also, note that it's "call" and not "Call". Anyway, I tried clicking the icon next to "get day of week from date". A little form appeared.
- In the field under "Function", type in the name of the function you are testing and select the function when it shows up.: There is a field called "function" (not "Function"), and the name "get day of week from date" is already there. So why should I type anything?
- Add values for the inputs in the respective fields.: This worked, I think.
- Click on "Select Function" under "Result Validation". In the field under "Function", type in the name of the function you want to use to check the result.: Similarly to #4 above, there's no "Select Function". Here's where I more or less got stuck.
Something is broken. Who can fix it? Amir E. Aharoni (talk) 01:03, 30 July 2024 (UTC)
- @Amire80 Thanks for this walkthrough. Would you please open a Phabricator ticket about it, and then link it here, so that I can send it to the team? Thanks! Sannita (WMF) (talk) 11:19, 31 July 2024 (UTC)
- Thanks, https://phabricator.wikimedia.org/T371487 . Amir E. Aharoni (talk) 12:24, 31 July 2024 (UTC)
- Should be fixed now. Tomorrow @Sannita (WMF) will fix the translation tags DSmit-WMF (talk) 18:08, 4 December 2025 (UTC)
- Thanks, https://phabricator.wikimedia.org/T371487 . Amir E. Aharoni (talk) 12:24, 31 July 2024 (UTC)
attach/detach
Towards the end of the page, there's this sentence: "Was the attach/detach state successfully changed?"
Is it actually supposed to be "attach/detach"? Perhaps it should "connected/disconnected"? Amir E. Aharoni (talk) 03:12, 30 July 2024 (UTC)
- I've changed it to "Connected/Disconnected". Please correct if I'm wrong. Amir E. Aharoni (talk) 03:06, 27 December 2024 (UTC)
Introduction with an information value equal ZERO
@User:Sannita (WMF) @User:Dv103: Apparently WF is to be activated on many wikis in a few days, and the announcement links to "Wikifunctions:Introduction". When looking that page, I cannot find any relevant information at all. Where do we have answers to the most basic questions about functions hosted here:
- What programming language are those coded in?
- What data types can they accept as input and output?
- Can they access other data than such fed in directly, such as WikiData, or pages in the
Data:namespace at commons? - How to create and edit functions without intrusive JawaScript that takes centuries to load and initialize, and hogs hundreds of MiO RAM on my computer putting it on the verge of a browser crash?
- Where is the source code of all those functions? For Z18546 for example.
- Have some wikis already been connected?
- How to access those functions from a wiki module or template?
- Where is an example of a simple useful function?
Taylor 49 (talk) 09:45, 15 September 2025 (UTC)
- Well I found Z18554 and wiki/Z18554?action=raw and wiki/Z18546?action=raw ... still the Introduction should provide the basic information. Taylor 49 (talk) 09:57, 15 September 2025 (UTC
- What does a function consist of? Do I always need at least two separate pages, one for the input and output lists, and one for the implementation? Do I always have to brew an input and output list first, before I am allowed to edit code? I also found that an implementation page offers Python and JawaScript. Is this the final list (ie no LUA)? Taylor 49 (talk) 10:19, 15 September 2025 (UTC)
- On Wikifunctions, a function is a global object (which mean an object permanentely stored in its page, with a permanent ZID) of type Function (Z8). As you can see in the Function type definition page, a Function object stores its arguments declarations (Z8K1), the return type (Z8K2), the connected testcases (Z8K3), the connected implementations (Z8K4) and the ZID of the function itself (Z8K5).
- One of the core ideas of Wikifunctions is that a function can have multiple implementations, which too are global objects of type Implementation (Z14) (which mean they too have their dedicated page, with their ZID). Similarly, a function can have some testcases, which have the purpose to check if the implementation are actually working correctly.
- Do I always have to brew an input and output list first, before I am allowed to edit code?
- Practically yes, since you first have to create the Function object before creating its implementations and testcases.
- Dv103 (talk) 15:00, 15 September 2025 (UTC)
- Well I found Z18554 and wiki/Z18554?action=raw and wiki/Z18546?action=raw ... still the Introduction should provide the basic information. Taylor 49 (talk) 09:57, 15 September 2025 (UTC
- For a better comprehension on the technical working of Wikifunctions, I'd advice to consult Wikifunctions:Function model.
- I'll still try to answer your questions:
- What programming language are those coded in?
- For now, the supported languages for implementations are Python, JavaScript and Composition (meaning that composes already existing Wikifunctions functions). Other programming languages might be added in the future.
- What data types can they accept as input and output?
- The complete list of Wikifunctions types is there. Note that not all those types are available on Wikitext.
- Can they access other data than such fed in directly, such as WikiData, or pages in the
Data:namespace at commons?
- Yes, they can access to all the Wikidata Item, Lexemes and Properties. For now it's not possible to access pages at commons. As an inportant note, it is not possible to execute SPARQL queries from Wikidata (Wikidata elements must be accessed by their ID)
- How to create and edit functions without intrusive JawaScript that takes centuries to load and initialize, and hogs hundreds of MiO RAM on my computer putting it on the verge of a browser crash?
- I don't think it's possible: all the Wikifunctions front-end is heavily dependant on JavaScript.
- Where is the source code of all those functions?
- If you open the page of the function (with JavaScript enabled in your browser), you can see all the implementations in the section "Implementations". Note that in Wikifunctions, a single function can have multiple implementations.
- Have some wikis already been connected?
- Yes: the Dagbani Wikipedia and 64 Wiktionary language editions.
- How to access those functions from a wiki module or template?
- For now it's not possible to do it. It's only possible to call a function directly from wikitext, as described in the introduction.
- Where is an example of a simple useful function?
- A simple example is the function age (Z20756): Age in years, that returns the number of years between 2 dates. For example, if I write
{{#function:Z20756|15 jan 2001|}}, the result is ⏳ Function is being called…, which is the number of years between the 15 January 2001 and now. (Note: you have to enable Parsoid in order to see the result of the function evaluation).
- Dv103 (talk) 14:46, 15 September 2025 (UTC)
- The currently supported Wiktionaries are:
- Amharic, Old English, Aragonese, Aymara, Central Bikol, Belarusian, Banjar, Mandailing Batak, Cherokee, Sorani, Corsican, Kashubian, Zazaki, Faroese, Guarani, Goan Konkani, Gorontalo, Gujarati, Gun, Manx, Fiji Hindi, Upper Sorbian, Interlingue, Lojban, Karakalpak, Tyap, Greenlandic, Kashmiri, Cornish, Lingala, Minangkabau, Māori, Macedonian, Meitei, Maltese, Nahuatl, Nias, Punjabi (both Shahmukhi and Gurmukhi scripts), Southern Quechua, Aromanian, Kinyarwanda, Sindhi, Shawiya, Samoan, Somali, Swazi, Sesotho, Sundanese, Tigrinya, Turkmen, Tswana, Tok Pisin, Tsonga, Uyghur, Venetian, Volapük, Wolof, Yiddish, Bangla, Dagbani, Divehi, Hausa, Igbo, and Malayalam. Dv103 (talk) 15:06, 15 September 2025 (UTC)
- Thanks.
- > not possible to do it. It's only possible to call a function directly from wikitext
- test:
- preview: FAIL (not parsed at all)
- FAIL "⏳ Function is being called…".
- works at 3:rd attempt
- >Yes: the Dagbani Wikipedia and 64 Wiktionary language editions.
- That means also that
- is faked, since WF currently is NOT enabled on English wikipedia. Or the shot is sort-of genuine but the function will NOT work.
- > Yes, they can access to all the Wikidata Item, Lexemes and Properties.
- > For now it's not possible to access pages at commons.
- Will it be possible? I mean namespace
Data:containing crucial centralized data. - Taylor 49 (talk) 23:01, 15 September 2025 (UTC)
- @Taylor 49 Hi, thank you for your interest and your questions. I saw that @Dv103 anticipated most of my answers, so I thank them too for that. No, the screenshot is for now only an example of how it will work in the future, Wikifunctions is still not deployed on English Wikipedia, but it is exemplificative of how it will work on Wiktionaries where it has been enabled. Sannita (WMF) (talk) 08:12, 16 September 2025 (UTC)
A little belated, but there is a page specifically about programming languages: WF:PROG — Arlo Barnes (talk) 20:24, 7 October 2025 (UTC)