[00:23:21] I've created a tool that should be able to generate ZObject JSON from psuedocode-like text. Z20000(2/3,2/3,2/3) would generate something that you could call in RunFunction or use Editsource to get. The only [01:37:24] If this is useful to you guys, I will make it public. Otherwise, it (re @Feeglgeef: I've created a tool that should be able to generate ZObject JSON from psuedocode-like text. Z20000(2/3,2/3,2/3) would generate s...) [01:57:50] String functions (re @Toby: Yes, many, but not for all languages. You may need to write them yourself, but there are lots of helper functions to make the co...) [01:57:50] I’m going to write some [01:58:24] Does this look good: [01:58:24] { [01:58:26] "types": { [01:58:27] "ZID": { [01:58:29] "hardcoded-as": "ZID" [01:58:30] }, [01:58:32] "string": { [01:58:33] "hardcoded-as": "string" [01:58:35] }, [01:58:36] "natural_number": { [01:58:38] "matchRegex": "\\d+", [01:58:39] "zid": "Z13518", [01:58:41] "keys": { [01:58:42] "Z13518K1": "string" [01:58:44] }, [01:58:45] "getKeyRule": "x" [01:58:47] }, [01:58:48] "boolean": { [01:58:50] "matchList": ["true", "false"], [01:58:51] "zid": "Z40", [01:58:53] "keys": { [01:58:54] "Z40K1": "ZID" [01:58:56] }, [01:58:57] "getKeyMap": { [01:58:59] "true": "Z41", [01:59:00] "false": "Z42" [01:59:02] } [01:59:04] }, [01:59:06] "sign": { [01:59:08] "matchList": ["+", "-", "positive", "negative", "neutral"] [01:59:10] "zid": "Z16659", [01:59:58] Shall you give some examples (re @Toby: Yes, many, but not for all languages. You may need to write them yourself, but there are lots of helper functions to make the co...) [02:01:00] There are at least 100 Breton ones (re @cvictorovich: Shall you give some examples) [02:01:37] WF:Catalogue/Natural_Language_Operations [02:01:47] WF:Catalogue [02:01:58] [[WF:Catalogue]] [02:02:25] https://www.wikifunctions.org/wiki/Wikifunctions:Catalogue/Natural_language_operations/Breton [02:03:56] I would advise, unlike the Breton ones, you make [[WF:BROAD]] functions. That's just my opinion tho, I can't make you :-) [02:05:14] Ex. I'd recommend making "Singular tense French verb", with perspective and number being inputs [07:47:27] I strongly diasgree with 2/3 of this essay [07:47:29] If you want to make complex function (the last 1/3), you need to have small to compose together (re @wikilinksbot: [[WF:BROAD]] ⮡ Wikifunctions:Broad) [07:50:14] good idea, you should even make a broader "French verb" function ! [07:50:15] but it doesn't mean that the small function are not equally a good idea and need for some cases (re @Feeglgeef: Ex. I'd recommend making "Singular tense French verb", with perspective and number being inputs) [09:26:23] I wish I could have submitted essays that were five sentences long at school :P [09:38:46] I don't know what the first statement means (the link to the wikipedia page is no help because I don't have a maths degree), and the second and third statements are too poorly justified [11:00:21] Could it be written as a string typed wikifunctions function? (re @Feeglgeef: If this is useful to you guys, I will make it public. Otherwise, it's not worth the hosting costs) [13:58:54] I suppose? Perhaps we can even JSON dump the object (re @Toby: Could it be written as a string typed wikifunctions function?) [13:59:40] I had to get rid of most of it because everyone disagreed with it :-( (re @Nikki: I wish I could have submitted essays that were five sentences long at school :P) [14:14:42] 'ello! [16:17:53] Ich war so deprimiert und konnte mein Kind nicht zur Schule schicken. Mein Freund hat mich ihnen vorgestellt und mein Leben hat sich verbessert. Ich kann sie alle wärmstens empfehlen. Zuerst habe ich 1.000 € eingezahlt, um den Markt zu testen. Innerhalb von 3 Tagen bekam ich 8.498,05 € zurück. Ihre harte Arbeit und Ehrlichkeit sind unbestreitbar. [16:17:54] @Maria_Heinrich2 [16:17:56] https://t.me/+4FNInLgmnjk4NjFk [17:05:41] Anyone know how I could get around this? : https://tools-static.wmflabs.org/bridgebot/9af119ad/file_66731.jpg [17:15:38] yeah but somehow you made it worse [17:15:38] you probably should start over from scratch and hear what people working on Wikifunctions (some for 6+ years) are saying (re @Feeglgeef: I had to get rid of most of it because everyone disagreed with it :-() [17:16:23] Really???? Have you seen the original version??????????? (re @Nicolas: yeah but somehow you made it worse [17:16:24] you probably should start over from scratch and hear what people working on Wikifunctions (so...) [17:16:42] the base of you ideas, we do need broad function, but it doesn't negate the need and use of smaller functions [17:16:52] I didn't say it does (re @Nicolas: the base of you ideas, we do need broad function, but it doesn't negate the need and use of smaller functions) [17:17:12] of course, I wouldn't have commented it without really reading it (including the history and the context) (re @Feeglgeef: Really???? Have you seen the original version???????????) [17:17:20] Many smaller functions might not be necessary (re @Nicolas: the base of you ideas, we do need broad function, but it doesn't negate the need and use of smaller functions) [17:17:39] They can be combined into larger ones [17:18:00] Example of something necessary: following month [17:18:00] Example of something unnecessary: 5 months after n month [17:18:06] "Avoid making small compositions" (re @Feeglgeef: I didn't say it does) [17:18:30] Avoid != Don't ever create, they are useless (re @Nicolas: "Avoid making small compositions") [17:18:44] why? you make judgement (which are strange to many people) without explaining anything (re @Feeglgeef: Example of something necessary: following month [17:18:44] Example of something unnecessary: 5 months after n month) [17:18:52] Basic functions can be built in codes [17:19:14] Larger ones in combination [17:20:01] Because: [17:20:02] There is little use for it [17:20:03] It removes flexibility. If I am user who wants to know the 5th month after January, but then want to know the 4th, that's impossible for me (re @Nicolas: why? you make judgement (which are strange to many people) without explaining anything) [17:20:05] true, but they might [17:20:06] I don't see reason to "avoid" them in principles (quite the opposite actually, breaking down a complex problem is smaller parts is the basic of the scientific method for millenias) (re @cvictorovich: Many smaller functions might not be necessary) [17:20:25] I'm not opposed to this (re @Nicolas: true, but they might [17:20:26] I don't see reason to "avoid" them in principles (quite the opposite actually, breaking down a complex prob...) [17:20:28] This is great [17:20:42] But you should try to make your smaller function usable in other contexts [17:21:06] which means? (re @Feeglgeef: But you should try to make your smaller function usable in other contexts) [17:21:21] Eg. I made the function "First true" [17:21:38] your essay sure looks like you should "Avoid making small compositions" :/ (re @Feeglgeef: I'm not opposed to this) [17:22:01] Your smaller parts should not be less than 2 function calls (re @Nicolas: your essay sure looks like you should "Avoid making small compositions" :/) [17:22:14] Otherwise you should just put the function call in the composition [17:22:21] Ideal smaller function is Z19602 [17:23:03] Used in Z19601 [17:23:28] again: why? [17:23:29] this could make sense or not, but with such a small statement it's very hard to tell what you mean and what you aim... (re @Feeglgeef: Your smaller parts should not be less than 2 function calls) [17:23:50] which should be avoided according to your essay... (re @Feeglgeef: Ideal smaller function is Z19602) [17:23:59] Why??? (re @Nicolas: which should be avoided according to your essay...) [17:24:29] Where does it say that [17:25:34] there is a big "Avoid making small compositions" followed by "Compositions with few function calls may not be necessary." (re @Feeglgeef: Why???) [17:26:54] there is probably some good ideas in what you are thinking but what you are actually writing is a strange and hard to understand mess [17:27:22] It's not a composition (re @Nicolas: there is a big "Avoid making small compositions" followed by "Compositions with few function calls may not be necessary.") [17:28:45] for instance the title shouldn't be "Avoid making small compositions" (which is a negative statement, implying it should never/rarely be done) but something like "when should we make small compositions or not" [17:31:11] again something that confused me, functions are never composition, only implementations can be composition (it's not the first time seing the confusion, and not just by you TBH, but when writing an essay, such confusion is complicating its understanding) (re @Feeglgeef: It's not a composition) [17:35:07] Yes, I think that’s a good way to think about it. And we should always try to give examples. (re @Nicolas: for instance the title shouldn't be "Avoid making small compositions" (which is a negative statement, implying it should never/r...) [18:29:07] Anyone know how to do this? (re @Feeglgeef: Anyone know how I could get around this?) [18:30:11] @vrandecic? [20:44:23] Where are you trying to get to, from where? (re @Feeglgeef: Anyone know how I could get around this?) [20:45:21] From what is currently outputted to a proper boolean (re @Al: Where are you trying to get to, from where?) [20:46:08] My code is returning the JSON object [20:46:08] { [20:46:09] Z1K1: Z40 [20:46:11] Z40K1: Z41 [20:46:12] } [20:46:14] And it's turning into a typed map instead of a boolean [20:55:23] If you want to get a proper object without using Wikifunctions type conversion, I think your only option is Z808 (which takes a list as input, not a map). This is not something I have explored, but if you’re already getting Typed pairs (in a map), you should be able to get typed pairs in a list (typed as Z39, Z1) 🤷‍♂️ (re @Feeglgeef: From what is currently outputted to a [20:55:23] proper boolean) [21:00:25] Idk how to take the map and turn it into a list (re @Al: If you want to get a proper object without using Wikifunctions type conversion, I think your only option is Z808 (which takes a ...) [21:02:09] Nor me. I think you need to avoid getting one in the first place. (re @Feeglgeef: Idk how to take the map and turn it into a list) [21:05:49] Idk how to do that either (re @Al: Nor me. I think you need to avoid getting one in the first place.) [21:16:59] Try Z805 with a Z41 Boolean object as the input argument. That should show you what you’re aiming for. (re @Feeglgeef: Idk how to do that either) [21:30:15] Is this an evaluated piece of code (i.e., Python or JavaScript)? If so, you should just return the native Boolean type (`True` and `true` respectively). (@Feeglgeef: My code is returning the JSON object ...) [21:30:36] If it's a composition, I'd need to see the entire function call to guide you. [21:31:46] I suppose that would work for this specific case, however, the code is supposed to generate ZObjects, so it should be able to nest them (re @wmtelegram_bot: Is this an evaluated piece of code (i.e., Python or JavaScript)? If so, you should just return the native Boolean type (...) [21:36:25] Z10000("Hello, ", "World!") should return Z10000("Hello, ", "World!") [21:36:56] Or {'Z1K1': 'Z7', 'Z7K1': 'Z10000', 'Z10000K1': {'Z1K1': 'Z6', 'Z6K1': 'Hello, '}, 'Z10000K2': {'Z1K1': 'Z6', 'Z6K1': 'World!'}} [21:55:49] I don't know what you're trying to do. Could you make a Phabricator task with details showing 1) what you tried to do, 2) what you got, and 3) what you expected? [21:58:32] If you're saying you are trying to write a function that returns a function call, that will get tricky. The system would immediately try to run such a function call. You'd need to wrap it in Z99 or something like that. However, if that's not what you mean, I'm lost :) [21:59:43] Something that takes an input as a string, and returns a proper Wikifunctions object (re @wmtelegram_bot: I don't know what you're trying to do. Could you make a Phabricator task with details showing 1) what you tried to do, 2...) [22:00:54] It would return a function call, and it evaluating would be good (re @wmtelegram_bot: If you're saying you are trying to write a function that returns a function call, that will get tricky. The system would...) [22:01:01] Or any supported object [22:02:11] When attempting certain things, I get a "[2024-11-23 19:26:29.971] [error] execution failed: unreachable, Code: 0x89\n[2024-11-23 19:26:29.971] [error] When executing function name: \"_start\" from the Wasm. I've already reported that, T380684 (re @wmtelegram_bot: I don't know what you're trying to do. Could you make a Phabricator task with details showing [22:02:11] 1) what you tried to do, 2...) [23:07:53] The canonical form of the object is {"Z1K1": "Z40", "Z40K1": "Z41"}. However, in the normalized form, "Z40" is not a String but an object of type Z9, so you could try returning something more like: [23:07:54] { [23:07:56] "Z1K1": { [23:07:57] "Z1K1": "Z9", [23:07:59] "Z9K1": "Z40"}, [23:08:00] "Z40K1": { [23:08:02] "Z1K1": "Z9", [23:08:03] "Z9K1": "Z41"} (re @Feeglgeef: My code is returning the JSON object [23:08:05] { [23:08:06] Z1K1: Z40 [23:08:08] Z40K1: Z41 [23:08:09] } [23:08:11] And it's turning into a typed map instead of a boolean) [23:08:40] pressing enter doesn't save when trying to add labels [23:09:09] Is that what I do in general for Z1K1? If so it would be a really easy change to the function builder. (re @Al: The canonical form of the object is {"Z1K1": "Z40", "Z40K1": "Z41"}. However, in the normalized form, "Z40" is not a String but ...) [23:09:37] Or rather, all objects received? [23:09:50] Could be… depends whether it works 😏 (re @Feeglgeef: Is that what I do in general for Z1K1? If so it would be a really easy change to the object builder.) [23:10:51] The evaluators expect all objects to be normalized, I believe. (re @Feeglgeef: Or rather, all objects received?) [23:11:19] I use a user script to deal w/ this 🤷‍♂️ (re @Nikki: pressing enter doesn't save when trying to add labels) [23:13:16] So I should replace Key(1, 1, "Z" + str(type)) with Key(1, 1, ZObject([Key(1,1,"Z9"),Key(9,1,"Z" + str(type)]))? (re @Al: Could be… depends whether it works 😏) [23:13:57] Or should that just generally be done for all keys? [23:20:50] If this is coming from the executors, then the reason you get a typed map is due to default type conversion. Arbitrary JSON objects (JS) and dicts (Python) are interpreted as typed Maps. If you want to return a Boolean, you should return `True` or `true`. Again, though, without more detail, this is hard to diagnose, and a Phabricator ticket would help immensely. [23:22:22] If you want to return a Z7/Function call from inside the executor, there's an object called `ZObject` (same name in both Python and JS) that you could use. That object would be properly type-converted to the Wikifunctions type you want. [23:24:06] I'm actually calling my own type ZObject, so I'd have to change that. If I create a ZObject with JSON, will it be properly output as an object, or what do I have to give it to create one? (re @wmtelegram_bot: If you want to return a Z7/Function call from inside the executor, there's an object called `ZObject` (same name in both...) [23:24:07] It's not particularly well-documented, which is something I should fix. But basically, if you wrap the thing you're trying to return in a `ZObject`, you should get the desired behavior. [23:24:21] Alright, thanks! [23:24:27] The definition of `ZObject` is here: https://gitlab.wikimedia.org/repos/abstract-wiki/wikifunctions/function-evaluator/-/blob/main/executors/python3/ztypes.py?ref_type=heads (Python) [23:24:42] or here (JS): https://gitlab.wikimedia.org/repos/abstract-wiki/wikifunctions/function-evaluator/-/blob/main/executors/javascript-wasmedge/ztypes.js?ref_type=heads [23:25:38] Thank you for helping out on your day off! 🙏 (re @wmtelegram_bot: It's not particularly well-documented, which is something I should fix. But basically, if you wrap the thing you're tryi...) [23:26:27] It uses kwargs, does that mean I have to put each individual key in? (re @wmtelegram_bot: The definition of `ZObject` is here: https://gitlab.wikimedia.org/repos/abstract-wiki/wikifunctions/function-evaluator/-...) [23:26:35] I guess I could unpack it to do that [23:26:39] also the interface has some sizing issues (this is from https://www.wikifunctions.org/wiki/Z4 in vector with the browser 893px wide) : https://tools-static.wmflabs.org/bridgebot/e4b4f920/file_66745.jpg [23:26:41] https://tools-static.wmflabs.org/bridgebot/6d8a535d/file_66746.jpg [23:26:52] (and what's not shown there is the 230px+ wide column of empty space) [23:27:14] https://www.wikifunctions.org/view/Z1002/Z10000 (re @Nikki: ) [23:27:54] It's much much much worse here (re @Feeglgeef: https://www.wikifunctions.org/view/Z1002/Z10000) [23:28:46] Because (I think) it confuses Wikifunctions into not accepting any fallbacks, so displays the raw message names [23:30:09] It's already on Phabricator, T380559. [23:30:33] No problem! I try to creep around here once a day 🙂 (@Al Thank you for helping out on your day off!) [23:32:03] If you're in Python, yeah, you can just double-splat it; in JS, it's a little awkward: you have to supply the original object (without `Z1K1`) as the first object and `Z1K1` as the second (@Feeglgeef: I guess I could unpack it to do that) [23:32:47] I'm sure there was a good reason to implement it that way, but probably not. Feel free to suggest improvements here; the default type conversion for non-built-in types is very much a placeholder! [23:33:13] If you're in Python, yeah, you can just double-splat it; in JS, it's a little awkward: you have to supply the original object (without `Z1K1`) as the first argument and `Z1K1` as the second (@Feeglgeef: I guess I could unpack it to do that) [23:34:29] /Z1002/ should just be /en/ in the url, I believe. (re @Feeglgeef: https://www.wikifunctions.org/view/Z1002/Z10000) [23:34:41] Yeah, it (re @Al: /Z1002/ should just be /en/ in the url, I believe.) [23:34:53] 's the Z1002 that makes it cursed [23:40:58] Don’t you get the same with any string that’s not a recognised MW language code? (Basically, there’s no fallback so you fall through to the native view, like qqx.) (re @Feeglgeef: 's the Z1002 that makes it cursed) [23:41:48] not quite, if you pass it any syntactically valid language code, it will fall back to en [23:41:53] No, https://www.wikifunctions.org/view/moyai/Z20289 (re @Al: Don’t you get the same with any string that’s not a recognised MW language code? (Basically, there’s no fallback so you fall thr...) [23:42:06] if you pass it nonsense, you get raw messages [23:42:41] The only time it happens for me is ZIDs or emojis [23:43:08] like https://www.wikifunctions.org/view/234353/Z20289 is still valid [23:44:16] 🗿 [23:45:24] also if it were deliberately falling back to qqx, it would show the rest of the interface as interface messages [23:46:12] Yeah [23:47:02] @vrandecic can I nominate Z20289 for FOTW?? [23:48:18] gahhhh does anyone know if there's a way to stop it from copying the id if I click on it? [23:48:40] I have a userscript to turn that off 🤷‍♂️ [23:52:12] I just don't have it public because I thought I was the only one who hated it [23:53:04] Oh, I see what you mean… That’s an interesting “feature”. (re @Nikki: also if it were deliberately falling back to qqx, it would show the rest of the interface as interface messages) [23:54:18] I absentmindedly selected some of the digits and bye bye clipboard, hope there wasn't anything important >_< [23:57:15] Can't you just deny it clipboard permissions????? (re @Nikki: I absentmindedly selected some of the digits and bye bye clipboard, hope there wasn't anything important >_<) [23:58:26] I like the click-to-copy but I did suggest it should be a right-click menu option, so I could copy the object name, its url, a wikilink or, of course, nothing at all! (re @Nikki: I absentmindedly selected some of the digits and bye bye clipboard, hope there wasn't anything important >_<)