The new library of functions will answer questions and enhance knowledge. Everyone, everywhere can access and contribute to it now.

Neat. I don’t like that the implementations have to name the function by some cryptic identifier, though. Real words matter in source code.

Who can tell me what this function is?

def Z10096(Z10096K1):
    return Z10096K1 == Z10096K1[::-1]

How about this?

def isPalimdrone(myString):
    return myString == myString[::-1]
lemmyvore
link
fedilink
English
41Y

Tbf it wasn’t so much the names that tripped me as the weird Python operator. I would’ve never guessed that’s a string reversal if you hadn’t told me (I don’t know much Python beyond recognizing the syntax). If I had to guess I would’ve said it’s an array pop.

When I originally typed it, I made a function for string reversal and called that. But I didn’t include it since I didn’t want to define that too.

Honestly… this wiki has a seriously difficult path ahead of it. I mean - it’d be fantastic if it did simplify things like that to let you write simple, elegant, and easy to read functions while linking to other functions.

But it’d also have to lint those and make sure that contributors don’t implement recursive dependencies.

S410
link
fedilink
111Y

“Our goal is knowledge, so we’re going to obfuscate everything to fuck and make things unreadable”

cannache
link
fedilink
41Y

No. Details and scope limitations please

monotremata
link
fedilink
461Y

It looks to me like they did it this way so that it could have natural-language names in many languages. So, the function Z10096 is called “is palindrome” in English, but if you’re coding in Japanese you can call it “回文の判定”. I don’t think the idea is for people to refer primarily to the alphanumeric soup version; I think that’s just the unique identifier for the database.

It does look like it’s leading to some issues, though. E.g., someone added a test for the “is palindrome” function which uses a somewhat common example: “Straw? No, too stupid. I put soot on warts.” Now, a human would probably say that this is a palindrome, because it’s got the same letters forwards and backwards, but most of the implementations disagree, because they consider the spaces, capitalization, and punctuation to be part of the string; that is, they test whether the input string and its reverse are equal. So someone (possibly the same person) has added a second python implementation which ignores spaces, capitalization, and punctuation, and mentions that in its name on the page.

Fundamentally this function is solving a different problem than the others (as demonstrated by the differing results on the relevant test), so should it get its own number and page? should there be a “palindrome disambiguation” page? This seems like something the site will have to figure out how to handle.

I think you’re absolutely correct about them choosing those awful identifiers so the functions are not language specific. It just hurts to read and thoroughly makes it harder to understand because my brain doesn’t tokenize “Z10096” and “Z10096K1”.

Create a post

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



  • 1 user online
  • 1 user / day
  • 1 user / week
  • 1 user / month
  • 1 user / 6 months
  • 1 subscriber
  • 1.21K Posts
  • 17.8K Comments
  • Modlog